Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

docs: align TypeScript error handling examples

Affaan Mustafab0a6847007c2
diff --git a/rules/typescript/coding-style.md b/rules/typescript/coding-style.md
index 582c40338..090c0a173 100644
--- a/rules/typescript/coding-style.md
+++ b/rules/typescript/coding-style.md
@@ -72,7 +72,7 @@ function getErrorMessage(error: unknown): string {
return error.message
}
- return 'Unknown error'
+ return 'Unexpected error'
}
```
@@ -158,12 +158,18 @@ function getErrorMessage(error: unknown): string {
return 'Unexpected error'
}
+const logger = {
+ error: (message: string, error: unknown) => {
+ // Replace with your production logger (for example, pino or winston).
+ }
+}
+
async function loadUser(userId: string): Promise<User> {
try {
const result = await riskyOperation(userId)
return result
} catch (error: unknown) {
- console.error('Operation failed:', error)
+ logger.error('Operation failed', error)
throw new Error(getErrorMessage(error))
}
}