Skip to content

Commit

Permalink
failAction loses stacktrace context
Browse files Browse the repository at this point in the history
Returning promise without await causes Node.js to lose stacktrace context making hapijs app harder to debug
  • Loading branch information
gugu authored and Marsup committed Jan 29, 2024
1 parent 7c67d19 commit a27f7e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/toolkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ exports.Manager = class {
this._toolkit.prototype[name] = method;
}

failAction(request, failAction, err, options) {
async failAction(request, failAction, err, options) {

const retain = options.retain ? err : undefined;
if (failAction === 'ignore') {
Expand All @@ -130,7 +130,7 @@ exports.Manager = class {
throw err;
}

return this.execute(failAction, request, { realm: request.route.realm, args: [options.details ?? err] });
return await this.execute(failAction, request, { realm: request.route.realm, args: [options.details ?? err] });
}
};

Expand Down

0 comments on commit a27f7e0

Please sign in to comment.