fix(bootstrap): report unexpected boot errors without a console call (09-04)
check:diagnostics refuses direct console use in src. The development report of an unclassified boot error now goes through reportError, which still lands in the browser console. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
8784354871
commit
69e40f106f
@@ -12,11 +12,12 @@ const ERROR_NAME_PATTERN = /^[A-Za-z][A-Za-z0-9]{0,39}$/u;
|
||||
/**
|
||||
* 09-04. A boot failure no loader classified: an assembly defect, a module
|
||||
* that threw while evaluating. It is shown as such, with the build and the
|
||||
* error's class name, never its message; a development build also logs the
|
||||
* original error, which is otherwise lost.
|
||||
* error's class name, never its message; a development build also reports
|
||||
* the original error to the console (`reportError`; direct console calls are
|
||||
* refused by check:diagnostics), where it was otherwise lost.
|
||||
*/
|
||||
export function unexpectedBootFailure(error: unknown): BootErrorShellProps {
|
||||
if (import.meta.env.DEV) console.error(error);
|
||||
if (import.meta.env.DEV) globalThis.reportError?.(error);
|
||||
const { buildId } = getBuildConfig();
|
||||
const name = error instanceof Error ? error.name : "";
|
||||
const code = ERROR_NAME_PATTERN.test(name) ? name : "UNKNOWN_ERROR";
|
||||
|
||||
Reference in New Issue
Block a user