MCPcopy Index your code
hub / github.com/simstudioai/sim / isSchemaMismatch

Function isSchemaMismatch

apps/realtime/src/database/preflight.ts:27–39  ·  view source on GitHub ↗

* Walks the `cause` chain so a SQLSTATE code is found even when drizzle wraps the * driver error (the code commonly lives on the inner `cause`, not the outer throw).

(error: unknown)

Source from the content-addressed store, hash-verified

25 * driver error (the code commonly lives on the inner `cause`, not the outer throw).
26 */
27function isSchemaMismatch(error: unknown): boolean {
28 const seen = new Set<unknown>()
29 let current: unknown = error
30 while (current && typeof current === 'object' && !seen.has(current)) {
31 seen.add(current)
32 const code = (current as { code?: unknown }).code
33 if (typeof code === 'string' && SCHEMA_MISMATCH_CODES.has(code)) {
34 return true
35 }
36 current = (current as { cause?: unknown }).cause
37 }
38 return false
39}
40
41/**
42 * Verifies, before the server accepts traffic, that the deployed image's schema

Callers 1

Calls 1

addMethod · 0.45

Tested by

no test coverage detected