Skip to content

Commit

Permalink
testlib/postgres.nim: simplify error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivansete-status committed Feb 29, 2024
1 parent d1ac066 commit b0e3c38
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tests/testlib/postgres.nim
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ const storeMessageDbUrl = "postgres://postgres:test123@localhost:5432/postgres"

proc newTestPostgresDriver*(): Future[Result[ArchiveDriver, string]] {.async.} =

proc onErr(errMsg: string) {.gcsafe, closure.} =
quit(QuitFailure)

let
vacuum = false
migrate = true
Expand All @@ -26,7 +23,8 @@ proc newTestPostgresDriver*(): Future[Result[ArchiveDriver, string]] {.async.} =
maxNumConn,
onErr)
if driverRes.isErr():
onErr("could not create archive driver: " & driverRes.error)
error("could not create archive driver: " & driverRes.error)
quit(QuitFailure)

return ok(driverRes.get())

0 comments on commit b0e3c38

Please sign in to comment.