/** * Pass #30: unhandled-exception (CWE-390, category: reliability) * * Detects explicit throw/raise statements that are not covered by any * try/catch in the same function. Uncaught exceptions surface as * unhandled-rejection crashes (Node.js) or propagate unexpectedly to * callers who may not anticipate them. * * Detection strategy (conservative, low false-positive): * 1. Build ExceptionFlowGraph. Derive "covered" line ranges as * [tryBlock.start_line, catchBlock.start_line − 1] for each pair. * 2. Scan source lines for explicit throw/raise keywords. * 3. Skip if the throw line is already inside a catch block (re-throw). * 4. Skip if the throw line falls within any covered range. * 5. Emit one finding per enclosing method (avoid duplicate findings for * multiple throws in the same uncovered method). * * Languages: JavaScript, TypeScript, Python only. * - Java: checked exceptions are intentionally propagated via `throws`; * too noisy without type hierarchy support. * - Rust/Bash: no traditional throw/raise; skip. */ import type { AnalysisPass, PassContext } from '../../graph/analysis-pass.js'; export interface UnhandledExceptionResult { unhandled: Array<{ line: number; method: string; }>; } export declare class UnhandledExceptionPass implements AnalysisPass { readonly name = "unhandled-exception"; readonly category: "reliability"; run(ctx: PassContext): UnhandledExceptionResult; } //# sourceMappingURL=unhandled-exception-pass.d.ts.map