(cause: unknown)
| 378 | classifySqliteError(sqliteCauseWithErrno(cause), { message, operation }) |
| 379 | |
| 380 | const sqliteCauseWithErrno = (cause: unknown): unknown => { |
| 381 | if (typeof cause !== "object" || cause === null || !("errcode" in cause) || "errno" in cause) { |
| 382 | return cause |
| 383 | } |
| 384 | const errcode = (cause as { readonly errcode: unknown }).errcode |
| 385 | if (typeof errcode !== "number") { |
| 386 | return cause |
| 387 | } |
| 388 | return Object.assign(cause, { errno: errcode }) |
| 389 | } |