19 lines
757 B
TypeScript
19 lines
757 B
TypeScript
const STARTUP_CAUSES = new Set([
|
|
"auth_config_invalid",
|
|
"auth_session_store_invalid",
|
|
"workspace_registry_invalid",
|
|
]);
|
|
|
|
const EXACT_CAUSES = new Map([
|
|
["authentication configuration is invalid", "auth_config_invalid"],
|
|
["authentication session state is invalid", "auth_session_store_invalid"],
|
|
["workspace registry configuration is invalid", "workspace_registry_invalid"],
|
|
]);
|
|
|
|
/** Return one bounded machine cause; never include the original error text or stack. */
|
|
export function formatStartupFailure(error: unknown): string {
|
|
const message = error instanceof Error ? error.message : "";
|
|
const cause = STARTUP_CAUSES.has(message) ? message : EXACT_CAUSES.get(message) ?? "startup_unknown";
|
|
return `backend startup failed: ${cause}`;
|
|
}
|