Skip to content

Commit

Permalink
Merge pull request #15 from alechirsch/master
Browse files Browse the repository at this point in the history
Any error not defined in this package gets swallowed
  • Loading branch information
olalonde committed Jan 20, 2017
2 parents af2b0aa + 4066038 commit 326e2d1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ var errors = {
};

function PgError(pgErr) {
var message = (errors[pgErr.code].message || 'Unknown Postgres error.') + ' Cause: ' + pgErr.message;
var message = (errors[pgErr.code] ? errors[pgErr.code].message : 'Postgres error.') + ' Cause: ' + pgErr.message;
var error = Error.call(this, message);
this.message = error.message;

this.name = errors[pgErr.code].name || 'PgError';
this.name = errors[pgErr.code] ? errors[pgErr.code].name : 'PgError';

this.stack = error.stack;
this.pgErr = pgErr;
Expand Down

0 comments on commit 326e2d1

Please sign in to comment.