From f714a6a183d11b70290898863b661019e66aa55d Mon Sep 17 00:00:00 2001 From: Sune Simonsen Date: Sun, 26 Jul 2015 22:48:26 +0200 Subject: [PATCH] Fix stack trace of errors that has been thrown when the work queue has been drained --- lib/oathbreaker.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/oathbreaker.js b/lib/oathbreaker.js index f7c8c60ba..4d0bf0e81 100644 --- a/lib/oathbreaker.js +++ b/lib/oathbreaker.js @@ -43,6 +43,9 @@ module.exports = function oathbreaker(value) { workQueue.drain(); if (evaluated && error) { + if (Error.captureStackTrace) { + Error.captureStackTrace(error); + } throw error; } else if (evaluated) { return value;