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
@@ -116,7 +116,9 @@ const sanitizeTargetTitle = (value: string, targetUrl: string): string => {
let url: URL;
try {
url = new URL(value);
} catch {
} catch (cause: unknown) {
// Non-URL titles fall back to alias redaction.
void cause;
return sanitizeTargetUrlAlias(value, targetUrl);
}
return url.protocol === "http:" || url.protocol === "https:"
@@ -128,7 +130,9 @@ const sanitizeTargetUrlAlias = (value: string, targetUrl: string): string => {
let parsed: URL;
try {
parsed = new URL(targetUrl);
} catch {
} catch (cause: unknown) {
// Without a parseable target URL there is nothing to redact.
void cause;
return value;
}
const markers = [parsed.origin, `//${parsed.host}`, parsed.host];
@@ -150,7 +154,9 @@ const sanitizeSameOriginTitleUrl = (candidate: string, target: URL): string => {
: candidate.startsWith(target.host)
? new URL(`${target.protocol}//${candidate}`)
: new URL(candidate, target.origin);
} catch {
} catch (cause: unknown) {
// Unparseable candidates are preserved verbatim.
void cause;
return candidate;
}
return parsed.origin === target.origin &&
@@ -273,7 +279,9 @@ const targetWebSocket = (
return webSocket.scope === "page" && webSocket.targetId === target.id
? { webSocket }
: {};
} catch {
} catch (cause: unknown) {
// Endpoint validation failures mean no validated transport exists.
void cause;
return {};
}
};