refactor(runtime): name all silent catch causes without changing diagnostics (#637)

* refactor(domain): split error taxonomy into thematic modules

Move each error family out of domain/errors.ts into its own module
(base, core, provider selection/adapter, browser observation,
artifact, evidence, unknown registry, hopper, configuration) and
relocate AnalysisErrorProjection to analysisErrorProjection.
Migrate all 162 importers to the owning modules and delete
errors.ts. No re-export shims; behavior is unchanged.

* refactor(runtime): name all silent catch causes without changing diagnostics

Bind cause in every bare catch and unhandled rejection across src/.
Real failures preserve the cause for logging; best-effort cleanup
carries an explicit comment. Caller-visible and Evidence strings are
byte-identical to before.
This commit is contained in:
morluto
2026-10-06 05:58:46 +08:00
committed by GitHub
parent 735c10059c
commit 5f27e02fae
65 changed files with 363 additions and 131 deletions
+12 -4
View File
@@ -11,7 +11,9 @@ const parseExactOrigin = (value: string): string | undefined => {
let url: URL;
try {
url = new URL(value);
} catch {
} catch (cause: unknown) {
// Invalid input is represented by the undefined return.
void cause;
return undefined;
}
if (
@@ -55,7 +57,9 @@ export const browserEndpointSchema = z
let url: URL;
try {
url = new URL(value);
} catch {
} catch (cause: unknown) {
// Invalid input is reported through the zod issue.
void cause;
context.addIssue({ code: "custom", message: "Invalid CDP endpoint URL" });
return z.NEVER;
}
@@ -160,7 +164,9 @@ export const sanitizeBrowserUrl = (value: string): SanitizedBrowserUrl => {
let parsed: URL;
try {
parsed = new URL(value);
} catch {
} catch (cause: unknown) {
// Unparseable input is preserved verbatim in the sanitized result.
void cause;
return {
url: value,
origin: null,
@@ -203,7 +209,9 @@ const removeUrlUserInfo = (value: string, parsed: URL): string => {
return candidateUrl.username === "" && candidateUrl.password === ""
? candidate
: credentialFreeHref(parsed);
} catch {
} catch (cause: unknown) {
// Fallback to the already-sanitized href when the candidate is invalid.
void cause;
return credentialFreeHref(parsed);
}
};