diff --git a/lib/db.js b/lib/db.js index 7cada8dc..04d8e937 100644 --- a/lib/db.js +++ b/lib/db.js @@ -38,16 +38,7 @@ const getDefaultSchema = () => 'ERROR_SCHEMA' const searchPathWrapper = (t, cb) => { return t.none('SET search_path TO $1:name', [getSchema()]) .then(cb.bind(t, t)) - .then(res => { - return t.none('SET search_path TO $1:name', [getDefaultSchema()]).then(() => { - return res - }) - }) - .catch(err => { - return t.none('SET search_path TO $1:name', [getDefaultSchema()]).then(() => { - throw err - }) - }) + .finally(() => t.none('SET search_path TO $1:name', [getDefaultSchema()])) } const pgp = Pgp({