[Pkg-javascript-commits] [node-asn1.js] 167/202: reporter: add .stack manually in IE

Bastien Roucariès rouca at moszumanska.debian.org
Thu Apr 20 19:19:05 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-asn1.js.

commit 858d3cae39512b98501758a05ed6f49b815e2b31
Author: Felix Hanley <felix at userspace.com.au>
Date:   Mon May 23 16:23:18 2016 +1000

    reporter: add .stack manually in IE
    
    Edge (and IE?) only adds a stack object to Error once it is
    thrown.
    
    See: https://msdn.microsoft.com/en-us/library/hh699850(v=vs.94).aspx
---
 lib/asn1/base/reporter.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/asn1/base/reporter.js b/lib/asn1/base/reporter.js
index 76f6045..62a2bcb 100644
--- a/lib/asn1/base/reporter.js
+++ b/lib/asn1/base/reporter.js
@@ -99,5 +99,13 @@ ReporterError.prototype.rethrow = function rethrow(msg) {
   if (Error.captureStackTrace)
     Error.captureStackTrace(this, ReporterError);
 
+  if (!this.stack) {
+    try {
+      // IE only adds stack when thrown
+      throw new Error(this.message);
+    } catch (e) {
+      this.stack = e.stack;
+    }
+  }
   return this;
 };

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-asn1.js.git



More information about the Pkg-javascript-commits mailing list