* A base class for all database related errors.
| 16 | * A base class for all database related errors. |
| 17 | */ |
| 18 | class DatabaseError |
| 19 | extends BaseError |
| 20 | implements DatabaseErrorParent, CommonErrorProperties |
| 21 | { |
| 22 | parent: Error; |
| 23 | original: Error; |
| 24 | sql: string; |
| 25 | parameters: object; |
| 26 | |
| 27 | /** |
| 28 | * @param parent The database specific error which triggered this one |
| 29 | * @param options |
| 30 | */ |
| 31 | constructor(parent: DatabaseErrorParent, options: ErrorOptions = {}) { |
| 32 | super(parent.message); |
| 33 | this.name = 'SequelizeDatabaseError'; |
| 34 | |
| 35 | this.parent = parent; |
| 36 | this.original = parent; |
| 37 | |
| 38 | this.sql = parent.sql; |
| 39 | this.parameters = parent.parameters ?? {}; |
| 40 | |
| 41 | if (options.stack) { |
| 42 | this.stack = options.stack; |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | export default DatabaseError; |
nothing calls this directly
no outgoing calls
no test coverage detected