From 76651fbb1fda96fe5f6dcaba69a34bcd8d37dbd0 Mon Sep 17 00:00:00 2001 From: Heather Arthur Date: Wed, 28 Mar 2012 13:24:44 +0100 Subject: [PATCH] Bug 721156 - aError.stack is undefined in the Error Console when exception is thrown in Scratchpad. r=robcee --- browser/devtools/scratchpad/scratchpad.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/browser/devtools/scratchpad/scratchpad.js b/browser/devtools/scratchpad/scratchpad.js index baf73c11f796..5de198ac3483 100644 --- a/browser/devtools/scratchpad/scratchpad.js +++ b/browser/devtools/scratchpad/scratchpad.js @@ -487,7 +487,8 @@ var Scratchpad = { */ writeAsErrorComment: function SP_writeAsErrorComment(aError) { - let newComment = "Exception: " + aError.message + "\n" + aError.stack.substring(0, aError.stack.length - 1); + let stack = aError.stack || aError.fileName + ":" + aError.lineNumber; + let newComment = "Exception: " + aError.message + "\n" + stack.replace(/\n$/, ""); this.writeAsComment(newComment); },