Skip to content

Commit 13c1def

Browse files
committed
improve sqlite error
1 parent 549641f commit 13c1def

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/easy_sqlite3/bindings.nim

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ type ResultCode* {.pure.} = enum
139139
sr_ioerr_rollback_atomic = 7946,
140140
sr_ioerr_data = 8202
141141
142-
type SQLiteError* = object of IOError
142+
type SQLiteError* = object of CatchableError
143+
code: Option[ResultCode]
143144
144145
type SQLiteBlob* = object
145146
raw: ptr UncheckedArray[byte]
@@ -366,7 +367,8 @@ proc sqlite3_column_value*(st: ptr RawStatement, idx: int): ptr RawValue {.impor
366367
{.pop.}
367368
368369
proc newSQLiteError*(code: ResultCode): ref SQLiteError =
369-
newException(SQLiteError, $sqlite3_errstr code)
370+
result = newException(SQLiteError, $sqlite3_errstr code)
371+
result.code = some code
370372
371373
proc newSQLiteError*(db: ptr RawDatabase): ref SQLiteError =
372374
newException(SQLiteError, $sqlite3_errmsg db)

0 commit comments

Comments
 (0)