Skip to content

Commit f7522aa

Browse files
committed
Add try catch
1 parent cad76c8 commit f7522aa

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

dist/content-visibility.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,5 +158,22 @@
158158
}
159159
}
160160

161-
return contentVisibility();
161+
// Try to execute the metric, with ultimate fallback
162+
try {
163+
return contentVisibility();
164+
} catch (error) {
165+
// Ultimate fallback - if even the main function fails
166+
return {
167+
used: false,
168+
count: 0,
169+
values: [],
170+
uniqueValues: [],
171+
debug: {
172+
stylesheetsProcessed: 0,
173+
styleBlocksProcessed: 0,
174+
inlineStylesProcessed: 0,
175+
errors: ['ultimate_error: ' + error.message]
176+
}
177+
};
178+
}
162179
})();

0 commit comments

Comments
 (0)