( message: string, code: string, constraint?: string, )
| 20 | } |
| 21 | |
| 22 | export const createPostgresError = ( |
| 23 | message: string, |
| 24 | code: string, |
| 25 | constraint?: string, |
| 26 | ): PostgresError => { |
| 27 | const error = new Error(message) as PostgresError |
| 28 | error.code = code |
| 29 | if (constraint !== undefined) { |
| 30 | error.constraint = constraint |
| 31 | } |
| 32 | return error |
| 33 | } |