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 _id = el;
|
||||||
var el = document.getElementById(_id);
|
var el = document.getElementById(_id);
|
||||||
if (!el)
|
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)
|
if (el.env && el.env.editor instanceof Editor)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ oop.inherits(Fold, RangeList);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!this.range.containsRange(fold))
|
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
|
// transform fold to local coordinates
|
||||||
consumeRange(fold, this.start);
|
consumeRange(fold, this.start);
|
||||||
|
|
@ -104,7 +104,7 @@ oop.inherits(Fold, RangeList);
|
||||||
var afterEnd = this.subFolds[j];
|
var afterEnd = this.subFolds[j];
|
||||||
|
|
||||||
if (cmp == 0)
|
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);
|
var consumedFolds = this.subFolds.splice(i, j - i, fold);
|
||||||
fold.setFoldLine(this.foldLine);
|
fold.setFoldLine(this.foldLine);
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ function FoldLine(foldData, folds) {
|
||||||
this.addFold = function(fold) {
|
this.addFold = function(fold) {
|
||||||
if (fold.sameRow) {
|
if (fold.sameRow) {
|
||||||
if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
|
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.push(fold);
|
||||||
this.folds.sort(function(a, b) {
|
this.folds.sort(function(a, b) {
|
||||||
|
|
@ -93,7 +93,7 @@ function FoldLine(foldData, folds) {
|
||||||
this.start.row = fold.start.row;
|
this.start.row = fold.start.row;
|
||||||
this.start.column = fold.start.column;
|
this.start.column = fold.start.column;
|
||||||
} else {
|
} 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;
|
fold.foldLine = this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ function Folding() {
|
||||||
// --- Some checking ---
|
// --- Some checking ---
|
||||||
if (!(startRow < endRow ||
|
if (!(startRow < endRow ||
|
||||||
startRow == endRow && startColumn <= endColumn - 2))
|
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 startFold = this.getFoldAt(startRow, startColumn, 1);
|
||||||
var endFold = this.getFoldAt(endRow, endColumn, -1);
|
var endFold = this.getFoldAt(endRow, endColumn, -1);
|
||||||
|
|
@ -285,7 +285,7 @@ function Folding() {
|
||||||
(startFold && !startFold.range.isStart(startRow, startColumn))
|
(startFold && !startFold.range.isStart(startRow, startColumn))
|
||||||
|| (endFold && !endFold.range.isEnd(endRow, endColumn))
|
|| (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.
|
// Check if there are folds in the range we create the new fold for.
|
||||||
|
|
|
||||||
|
|
@ -937,7 +937,7 @@ module.exports = {
|
||||||
fail = true;
|
fail = true;
|
||||||
}
|
}
|
||||||
if (fail != shouldFail) {
|
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) {
|
function setupContainer(element, getValue) {
|
||||||
if (element.type != 'textarea') {
|
if (element.type != 'textarea') {
|
||||||
throw "Textarea required!";
|
throw new Error("Textarea required!");
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentNode = element.parentNode;
|
var parentNode = element.parentNode;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue