replaced simple string errors with full Errors, in order to make debugging easier.
This commit is contained in:
parent
e316578832
commit
4d62c0810b
6 changed files with 9 additions and 9 deletions
|
|
@ -75,7 +75,7 @@ exports.edit = function(el) {
|
|||
var _id = el;
|
||||
var el = document.getElementById(_id);
|
||||
if (!el)
|
||||
throw "ace.edit can't find div #" + _id;
|
||||
throw new Error("ace.edit can't find div #" + _id);
|
||||
}
|
||||
|
||||
if (el.env && el.env.editor instanceof Editor)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ oop.inherits(Fold, RangeList);
|
|||
return;
|
||||
|
||||
if (!this.range.containsRange(fold))
|
||||
throw "A fold can't intersect already existing fold" + fold.range + this.range;
|
||||
throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
|
||||
|
||||
// transform fold to local coordinates
|
||||
consumeRange(fold, this.start);
|
||||
|
|
@ -104,7 +104,7 @@ oop.inherits(Fold, RangeList);
|
|||
var afterEnd = this.subFolds[j];
|
||||
|
||||
if (cmp == 0)
|
||||
throw "A fold can't intersect already existing fold" + fold.range + this.range;
|
||||
throw new Error("A fold can't intersect already existing fold" + fold.range + this.range);
|
||||
|
||||
var consumedFolds = this.subFolds.splice(i, j - i, fold);
|
||||
fold.setFoldLine(this.foldLine);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ function FoldLine(foldData, folds) {
|
|||
this.addFold = function(fold) {
|
||||
if (fold.sameRow) {
|
||||
if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
|
||||
throw "Can't add a fold to this FoldLine as it has no connection";
|
||||
throw new Error("Can't add a fold to this FoldLine as it has no connection");
|
||||
}
|
||||
this.folds.push(fold);
|
||||
this.folds.sort(function(a, b) {
|
||||
|
|
@ -93,7 +93,7 @@ function FoldLine(foldData, folds) {
|
|||
this.start.row = fold.start.row;
|
||||
this.start.column = fold.start.column;
|
||||
} else {
|
||||
throw "Trying to add fold to FoldRow that doesn't have a matching row";
|
||||
throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");
|
||||
}
|
||||
fold.foldLine = this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ function Folding() {
|
|||
// --- Some checking ---
|
||||
if (!(startRow < endRow ||
|
||||
startRow == endRow && startColumn <= endColumn - 2))
|
||||
throw "The range has to be at least 2 characters width";
|
||||
throw new Error("The range has to be at least 2 characters width");
|
||||
|
||||
var startFold = this.getFoldAt(startRow, startColumn, 1);
|
||||
var endFold = this.getFoldAt(endRow, endColumn, -1);
|
||||
|
|
@ -285,7 +285,7 @@ function Folding() {
|
|||
(startFold && !startFold.range.isStart(startRow, startColumn))
|
||||
|| (endFold && !endFold.range.isEnd(endRow, endColumn))
|
||||
) {
|
||||
throw "A fold can't intersect already existing fold" + fold.range + startFold.range;
|
||||
throw new Error("A fold can't intersect already existing fold" + fold.range + startFold.range);
|
||||
}
|
||||
|
||||
// Check if there are folds in the range we create the new fold for.
|
||||
|
|
|
|||
|
|
@ -937,7 +937,7 @@ module.exports = {
|
|||
fail = true;
|
||||
}
|
||||
if (fail != shouldFail) {
|
||||
throw "Expected to get an exception";
|
||||
throw new Error("Expected to get an exception");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ function applyStyles(elm, styles) {
|
|||
|
||||
function setupContainer(element, getValue) {
|
||||
if (element.type != 'textarea') {
|
||||
throw "Textarea required!";
|
||||
throw new Error("Textarea required!");
|
||||
}
|
||||
|
||||
var parentNode = element.parentNode;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue