-
-
Couldn't load subscription status.
- Fork 429
Closed
Labels
Description
From
Line 607 in c37b7ee
| Whenever an error occurs within SQLite3, a `SqliteError` object will be thrown. `SqliteError` is a subclass of `Error`. Every `SqliteError` object has a `code` property, which is a string matching one of error codes defined [here](https://sqlite.org/rescode.html) (for example, `"SQLITE_CONSTRAINT"`). |
Every
SqliteErrorobject has acodeproperty, which is a string matching one of error codes defined here (for example,"SQLITE_CONSTRAINT")
Looking at https://sqlite.org/rescode.html, SQLITE_CONSTRAINT is a "Primary Result Code", but SqliteError objects seem to contain "Extended Result Codes" instead, such as SQLITE_CONSTRAINT_UNIQUE.
SqliteError: UNIQUE constraint failed: accounts.email
at eval (/src/lib/database.ts:252:16)
at sqliteTransaction ([...]/node_modules/better-sqlite3/lib/methods/transaction.js:65:24)
at Module.createAccount (/src/lib/database.ts:257:7)
[...] {
code: 'SQLITE_CONSTRAINT_UNIQUE'
}
The documentation should probably give an extended result code as example, and should probably mention the difference, because users trying to compare the SqliteError.code with a primary result code will not get the result they expect.