From c322eaa1bc311c2b562a12db171cfa7d8e51d5b9 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Thu, 5 Feb 2015 18:39:43 -0500 Subject: [PATCH] Restore Error workaround in Bluebird to produce proper line numbers I didn't really investigate this, but errors from the outside world seem to not pass the "obj instanceof Error" test due to some weirdness that Bluebird is doing. (When I took this out recently I thought we just were throwing some custom errors that didn't properly extend Error, but that isn't the issue.) This restores the earlier workaround. --- resource/bluebird.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/resource/bluebird.js b/resource/bluebird.js index 9c85e6e546..b4b8bc7772 100644 --- a/resource/bluebird.js +++ b/resource/bluebird.js @@ -4675,6 +4675,9 @@ function originatesFromRejection(e) { } function canAttachTrace(obj) { + // Added by Zotero + return obj.message && obj.stack && es5.propertyIsWritable(obj, "stack"); + return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); }