Permalink
Browse files

fix bug: error isn't shown sometimes

  • Loading branch information...
1 parent 4d261db commit e7df95c6d259f5f24657af81aa1eaf042620769a @nightwing nightwing committed Mar 17, 2012
Showing with 24 additions and 11 deletions.
  1. +24 −11 chrome/content/aceEditor.js
@@ -630,6 +630,9 @@ Firebug.largeCommandLineEditor = {
setErrorLocation: function(context){
Firebug.CommandLine.evaluate('++++', context, context.thisValue, null,
dump, function(error) {
+ // happens when stopped in debugger
+ if (!error.source)
+ return
var source = error.source.split('++++')
context.errorLocation={
fileName: error.fileName,
@@ -666,20 +669,30 @@ Firebug.largeCommandLineEditor = {
Firebug.Console.log(e);
},
logError: function(error) {
- var loc = Firebug.currentContext.errorLocation
- var self = Firebug.largeCommandLineEditor;
- var source = (error.source||'').slice(loc.before, loc.after);
- if (loc.fileName == error.fileName || source == self.lastEvaledCode) {
- var cellStart = self.cell.bodyStart;
- var lineNumber = error.lineNumber - loc.lineNumber;
- var lines = source.split('\n');
- var line = lines[lineNumber]||lines[lineNumber-1];
+ try {
+ var loc = Firebug.currentContext.errorLocation
+ var self = Firebug.largeCommandLineEditor;
+ if (loc) {
+ var source = (error.source||'').slice(loc.before, loc.after);
+ var detailedInfo = loc.fileName == error.fileName || source == self.lastEvaledCode
+ }
+
+ if (!detailedInfo){
+ Firebug.Console.log(error, null, "errorMessage");
+ return
+ }
+
+ var cellStart = self.cell.bodyStart;
+ var lineNumber = error.lineNumber - loc.lineNumber;
+ var lines = source.split('\n');
+ var line = lines[lineNumber]||lines[lineNumber-1];
error.source = source
- Firebug.Console.log(
+ Firebug.Console.log(
error.toString() + ' `' + line + '` @'+(lineNumber+cellStart), null, "errorMessage"
);
- } else
+ } catch (e) {
Firebug.Console.log(error, null, "errorMessage");
+ }
},
logCoffeeError: function(error) {
var lineNumber = error.row+this.cell.bodyStart
@@ -706,7 +719,7 @@ Firebug.largeCommandLineEditor = {
"/**press ctrl+space inside ()**/\n#>>\n";
if (option == "2")
this.setValue(help);
- else if (option == "1") {
+ else if (option == "1") {
var file = Firebug.Ace.getUserFile('autosave');
if (file.exists())
var val = readEntireFile(file);

0 comments on commit e7df95c

Please sign in to comment.