UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

35 lines (34 loc) 1.77 kB
//#region src/state/openclaw-state-db-schema-migration-required.ts const GATEWAY_STATE_SCHEMA_MIGRATION_REQUIRED_REASON = "gateway.state_schema_migration_required"; var OpenClawStateDatabaseSchemaMigrationRequiredError = class extends Error { constructor(kind, pathname) { super(`OpenClaw state database schema migration required (${kind}) at ${pathname}; run openclaw doctor --fix to migrate it.`); this.kind = kind; this.pathname = pathname; this.code = GATEWAY_STATE_SCHEMA_MIGRATION_REQUIRED_REASON; this.name = "OpenClawStateDatabaseSchemaMigrationRequiredError"; } }; const STATE_SCHEMA_MIGRATION_REQUIRED_MESSAGE = /^OpenClaw state database schema migration required \((agent-databases-composite-primary-key|audit-events-v2)\) at (.+); run openclaw doctor --fix to migrate it\.$/u; function parseStateSchemaMigrationRequiredMessage(message) { if (typeof message !== "string") return; const match = STATE_SCHEMA_MIGRATION_REQUIRED_MESSAGE.exec(message); const kind = match?.[1]; const pathname = match?.[2]; if (!kind || !pathname) return; return new OpenClawStateDatabaseSchemaMigrationRequiredError(kind, pathname); } function findOpenClawStateDatabaseSchemaMigrationRequiredError(error) { let current = error; const seen = /* @__PURE__ */ new Set(); while (current && typeof current === "object" && !seen.has(current)) { if (current instanceof OpenClawStateDatabaseSchemaMigrationRequiredError) return current; const errorLike = current; const parsed = parseStateSchemaMigrationRequiredMessage(errorLike.message); if (parsed) return parsed; seen.add(current); current = errorLike.cause; } } //#endregion export { findOpenClawStateDatabaseSchemaMigrationRequiredError as n, OpenClawStateDatabaseSchemaMigrationRequiredError as t };