(error: unknown)
| 2 | import type { SqlError } from 'mariadb' |
| 3 | |
| 4 | export function convertDriverError(error: unknown): DriverAdapterErrorObject { |
| 5 | if (isDriverError(error)) { |
| 6 | return { |
| 7 | originalCode: error.errno.toString(), |
| 8 | originalMessage: error.sqlMessage ?? 'N/A', |
| 9 | ...mapDriverError(error), |
| 10 | } |
| 11 | } |
| 12 | |
| 13 | throw error |
| 14 | } |
| 15 | |
| 16 | export function mapDriverError(error: DriverError): MappedError { |
| 17 | switch (error.errno) { |
no test coverage detected