Skip to content

Commit 4a1ba6e

Browse files
refactor: use catch without binding for intentionally ignored exceptions
- Change catch (e) to catch to avoid unused variable - Uses ES2019 optional catch binding syntax - Maintains debug logging for troubleshooting - Clear comments explain the intentional exception ignoring - Should satisfy SonarCloud by handling the catch with logging
1 parent 8f91730 commit 4a1ba6e

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/cloudevents/tools/generator/docs-generator/generate-docs-cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,10 @@ try {
145145
process.exit(1);
146146
});
147147
}
148-
} catch (e) {
149-
// Intentionally ignoring: import.meta not available in CommonJS/Jest environments
150-
// This is expected when the module is imported rather than executed directly
148+
} catch {
149+
// Intentionally ignoring exception: import.meta not available in CommonJS/Jest environments.
150+
// This is expected when the module is imported rather than executed directly.
151151
if (process.env.DEBUG) {
152152
console.debug('Module loaded in CommonJS/Jest environment (import.meta not available)');
153153
}
154-
void e; // Mark exception as intentionally unused
155154
}

src/cloudevents/tools/generator/readme-generator/update-readme-cli.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,10 @@ try {
7979
process.exit(1);
8080
});
8181
}
82-
} catch (e) {
83-
// Intentionally ignoring: import.meta not available in CommonJS/Jest environments
84-
// This is expected when the module is imported rather than executed directly
82+
} catch {
83+
// Intentionally ignoring exception: import.meta not available in CommonJS/Jest environments.
84+
// This is expected when the module is imported rather than executed directly.
8585
if (process.env.DEBUG) {
8686
console.debug("Module loaded in CommonJS/Jest environment (import.meta not available)");
8787
}
88-
void e; // Mark exception as intentionally unused
8988
}

0 commit comments

Comments
 (0)