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
+9 -3
View File
@@ -130,7 +130,9 @@ const cspSource = (
return allowedOrigins.has(parsed.origin)
? { kind: "approved_origin", value: parsed.origin }
: { kind: "external_origin", value: null };
} catch {
} catch (cause: unknown) {
// Non-URL tokens are classified as other.
void cause;
return { kind: "other", value: null };
}
};
@@ -210,7 +212,9 @@ const safeDestination = (
if (!allowedOrigins.has(parsed.origin))
return { url: sanitized, scope: "outside_policy" };
return { url: sanitized, scope: "approved" };
} catch {
} catch (cause: unknown) {
// Unparseable link values keep their raw text for the analyst.
void cause;
return { url: value, scope: "unsupported" };
}
};
@@ -231,7 +235,9 @@ const wellKnownHint = (url: string): AgentHint[] => {
return wellKnownAgentPaths.has(path)
? [agentHint("well_known_resource", path, sanitizeBrowserUrl(url).url)]
: [];
} catch {
} catch (cause: unknown) {
// Non-URL input yields no well-known hint.
void cause;
return [];
}
};