Skip to content

Commit

Permalink
db.pg: add support for -d trace_pg_error
Browse files Browse the repository at this point in the history
  • Loading branch information
spytheman committed Apr 17, 2023
1 parent 3b2e58e commit 8275dc5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vlib/db/pg/pg.v
Expand Up @@ -279,6 +279,9 @@ fn (db DB) handle_error_or_result(res voidptr, elabel string) ![]Row {
e := unsafe { C.PQerrorMessage(db.conn).vstring() }
if e != '' {
C.PQclear(res)
$if trace_pg_error ? {
eprintln('pg error: ${e}')
}
return error('pg ${elabel} error:\n${e}')
}
return res_to_rows(res)
Expand Down

0 comments on commit 8275dc5

Please sign in to comment.