Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
Removed override of error code property (#68)
Browse files Browse the repository at this point in the history
refs TryGhost/Ghost#10415
refs TryGhost/Ghost#10181
refs TryGhost/Ghost#10421

When supplying a code to an ignition error, if you pass an error with a code, the error's code takes precedence rather than the explicit code you pass.
  • Loading branch information
allouis authored Jan 28, 2019
1 parent 1041c82 commit cc59c95
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/errors/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ function IgnitionError(options) {
return;
}

// CASE: `code` should put options as priority over err
if (property === 'code') {
self[property] = self[property] || options.err[property];
}

if (property === 'stack') {
self[property] += '\n\n' + options.err[property];
return;
Expand Down

0 comments on commit cc59c95

Please sign in to comment.