-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
We need to handle Database errors in higher level, and we wan't to check if error come from db, and in that case error code is a specific code. Please export DatabaseError class from node-postgres
to able to achieve that.
// Current workaround but its hacky.
import { DatabaseError } from 'pg-protocol/dist/messages';
/** https://www.postgresql.org/docs/current/errcodes-appendix.html */
enum postgresErrorCodes {
read_only_sql_transaction = '25006'
}
if (error instanceof DatabaseError && error.code == postgresErrorCodes.read_only_sql_transaction) {
// handle write modification tries
}
unematiii and liangjingyang
Metadata
Metadata
Assignees
Labels
No labels