(cause: unknown)
| 42 | const ATTR_DB_NAMESPACE = "db.namespace" |
| 43 | |
| 44 | const clickhouseCodeFromCause = (cause: unknown): number | undefined => { |
| 45 | if (typeof cause !== "object" || cause === null || !("code" in cause)) { |
| 46 | return undefined |
| 47 | } |
| 48 | const code = cause.code |
| 49 | if (typeof code === "number") { |
| 50 | return code |
| 51 | } |
| 52 | if (typeof code === "string") { |
| 53 | const parsed = Number(code) |
| 54 | return Number.isNaN(parsed) ? undefined : parsed |
| 55 | } |
| 56 | return undefined |
| 57 | } |
| 58 | |
| 59 | const clickhouseSyntaxErrorCodes = new Set([36, 60, 62, 242]) |
| 60 |
no test coverage detected