Make record not found error messages more descriptive.

This commit is contained in:
Jonathan Bernard 2020-01-02 18:42:48 -06:00
parent 56a257be2e
commit 126c4f1c7c

View File

@ -50,8 +50,8 @@ template getRecord*(db: DbConn, modelType: type, id: typed): untyped =
" FROM " & tableName(modelType) &
" WHERE id = ?"), @[$id])
if row.allIt(it.len == 0):
raise newException(NotFoundError, "no record for id " & $id)
if allIt(row, it.len == 0):
raise newException(NotFoundError, "no " & modelName(modelType) & " record for id " & $id)
rowToModel(modelType, row)