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