feat(auth): integrate authentication with installation lifecycle
This commit is contained in:
@@ -4,9 +4,15 @@ const STARTUP_CAUSES = new Set([
|
||||
"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 : "startup_unknown";
|
||||
const cause = STARTUP_CAUSES.has(message) ? message : EXACT_CAUSES.get(message) ?? "startup_unknown";
|
||||
return `backend startup failed: ${cause}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user