ErrorLens scans codebases for dangerous error handling patterns: empty catch blocks, swallowed exceptions, missing error boundaries, unhandled promise rejections, generic error types, missing finally blocks, bare except clauses, error message information leaks, unchecked error returns, and missing error propagation. Covers JS/TS, Python, Java, Go, Rust, and C#. Uses regex-based pattern matching against 90+ error handling anti-patterns, lefthook for git hook integration, and produces markdown reports with actionable remediation recommendations. 100% local. Zero telemetry.
errorlens scan [file|directory]
One-shot error handling scan of files or directories.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" scan [target]
What it does:
Example usage scenarios:
errorlens scan .
errorlens scan src/api.ts
errorlens scan src/
errorlens scan .
errorlens scan .
errorlens hook
Install git pre-commit hooks that scan staged files for error handling issues before every commit.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" hook install
What it does:
errorlens report [directory]
Generate a markdown error handling report with findings, severity breakdown, and remediation steps.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" report [directory]
What it does:
errorlens watch [directory]
Continuous monitoring mode that watches for file changes and re-scans automatically.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" watch [directory]
What it does:
errorlens ci [directory]
CI/CD integration mode with strict exit codes and machine-readable output.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" ci [directory]
What it does:
errorlens team-report [directory]
Aggregate team-level error handling metrics and trends.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" team-report [directory]
What it does:
errorlens baseline [directory]
Establish a baseline of known error handling issues for incremental improvement tracking.
How to execute:
bash "<SKILL_DIR>/scripts/errorlens.sh" baseline [directory]
What it does:
errorlens status
Show license and configuration information.
bash "<SKILL_DIR>/scripts/errorlens.sh" status
ErrorLens detects 90+ error handling anti-patterns across 6 categories:
| Category | Examples | Severity |
|----------|----------|----------|
| Empty Catches (EC) | Empty catch blocks in JS/TS/Java/C#/Python, catch with only comments, catch with only pass, catch-all without logging | Critical/High |
| Swallowed Exceptions (SE) | Catch blocks that don't rethrow/log, exception variable unused, catch that returns null/undefined/false silently, ignored error callbacks | Critical/High |
| Error Boundaries (EB) | Missing React error boundaries, missing Express error middleware, missing global handlers, unhandled promise rejections, window.onerror | High/Medium |
| Generic Errors (GE) | Throwing generic Error/Exception, bare except in Python, catching Throwable in Java, catching Object in TS, overly broad error types | High/Medium |
| Resource & Propagation (RP) | Missing finally for resource cleanup, unchecked error returns in Go, missing error propagation (? in Rust), ignored Result types, missing defer/close | High/Medium |
| Information Leak (IL) | Stack traces in HTTP responses, error.message in API responses, console.error with sensitive data, verbose errors in production, raw exception details to users | High/Medium |
Users can configure ErrorLens in ~/.openclaw/openclaw.json:
{
"skills": {
"entries": {
"errorlens": {
"enabled": true,
"apiKey": "YOUR_LICENSE_KEY_HERE",
"config": {
"severityThreshold": "high",
"ignorePatterns": ["**/test/**", "**/fixtures/**", "**/*.test.*"],
"ignoreChecks": [],
"allowlistFile": ".errorlens-allowlist",
"reportFormat": "markdown"
}
}
}
}
}
hook install, prompt to install it
The user might say things like:
共 1 个版本