From 282139fc63c4d0cac801ea937d50f541ca78b87b Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Mon, 19 Dec 2016 11:09:59 +0000 Subject: [PATCH] Add traceback to unhandled promise rejections --- src/ng/q.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ng/q.js b/src/ng/q.js index 305626150d99..de396b2d7c02 100644 --- a/src/ng/q.js +++ b/src/ng/q.js @@ -381,7 +381,11 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) { if (!toCheck.pur) { toCheck.pur = true; var errorMessage = 'Possibly unhandled rejection: ' + toDebugString(toCheck.value); - exceptionHandler(errorMessage); + if (toCheck.value instanceof Error) { + exceptionHandler(toCheck.value, errorMessage); + } else { + exceptionHandler(errorMessage); + } } } }