Skip to content

Commit

Permalink
Wrap SavedExtension in try-catch
Browse files Browse the repository at this point in the history
Some sb2 records don't contain Extensions expected by clients (ie. env-crawler).
  • Loading branch information
scratchnitch authored Sep 18, 2024
1 parent 0f4220d commit 5737e15
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/sb2.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,14 @@ const blocks = function (project) {
*/
const extensions = function (project) {
const result = {count: 0, id: []};
const ext = project.info.savedExtensions;

try {
const ext = project.info.savedExtensions;

Check failure on line 171 in lib/sb2.js

View workflow job for this annotation

GitHub Actions / setup

'ext' is assigned a value but never used. Allowed unused vars must match /^_/u

Check failure on line 171 in lib/sb2.js

View workflow job for this annotation

GitHub Actions / setup

Trailing spaces not allowed
} catch (error) {
if (error instanceof TypeError) {
console.log("A TypeError occurred:", error.message);

Check failure on line 174 in lib/sb2.js

View workflow job for this annotation

GitHub Actions / setup

Expected indentation of 12 spaces but found 10

Check failure on line 174 in lib/sb2.js

View workflow job for this annotation

GitHub Actions / setup

Strings must use singlequote
}
}

// Check to ensure project includes any extensions
if (typeof ext === 'undefined') return result;
Expand Down

0 comments on commit 5737e15

Please sign in to comment.