Skip to content

Commit

Permalink
Merge pull request #180 from Shyp/pass-thru-error
Browse files Browse the repository at this point in the history
Attach the original Postgres error to unique errors
  • Loading branch information
particlebanana committed Aug 20, 2015
2 parents dfb2229 + ce30b10 commit fbaf410
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/adapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,9 @@ module.exports = (function() {
if (matches && matches.length) {
formattedErr = {};
formattedErr.code = 'E_UNIQUE';
// This is the same property that is set on WLError instances.
// Accessible as `.originalError` on a WLValidationError instance.
formattedErr.originalError = err;
formattedErr.invalidAttributes = {};
formattedErr.invalidAttributes[matches[1]] = [{
value: matches[2],
Expand Down

0 comments on commit fbaf410

Please sign in to comment.