improve coffee script error messages
This commit is contained in:
parent
32b255963d
commit
f4a9c1bc78
2 changed files with 15 additions and 0 deletions
|
|
@ -225,6 +225,7 @@ define(function(require, exports, module) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (match = HEREGEX.exec(this.chunk)) {
|
if (match = HEREGEX.exec(this.chunk)) {
|
||||||
|
this.line += count(match[0], '\n');
|
||||||
return this.heregexToken(match);
|
return this.heregexToken(match);
|
||||||
}
|
}
|
||||||
prev = last(this.tokens);
|
prev = last(this.tokens);
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ oop.inherits(Worker, Mirror);
|
||||||
|
|
||||||
this.onUpdate = function() {
|
this.onUpdate = function() {
|
||||||
var value = this.doc.getValue();
|
var value = this.doc.getValue();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
coffee.parse(value);
|
coffee.parse(value);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
|
|
@ -66,6 +67,19 @@ oop.inherits(Worker, Mirror);
|
||||||
text: m[2],
|
text: m[2],
|
||||||
type: "error"
|
type: "error"
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (e instanceof SyntaxError) {
|
||||||
|
var m = e.message.match(/ on line (\d+)/);
|
||||||
|
if (m) {
|
||||||
|
this.sender.emit("error", {
|
||||||
|
row: parseInt(m[1]) - 1,
|
||||||
|
column: null,
|
||||||
|
text: e.message.replace(m[0], ""),
|
||||||
|
type: "error"
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue