Merge e0e72209f0 into 37d7cb8565
This commit is contained in:
commit
8206f7a860
|
|
@ -178,16 +178,15 @@ function parse_js_number(num) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function JS_Parse_Error(message, line, col, pos) {
|
function JS_Parse_Error(message, line, col, pos) {
|
||||||
this.message = message;
|
this.message = message + " (line: " + line + ", col: " + col + ", pos: " + pos + ")";
|
||||||
this.line = line;
|
this.line = line;
|
||||||
this.col = col;
|
this.col = col;
|
||||||
this.pos = pos;
|
this.pos = pos;
|
||||||
this.stack = new Error().stack;
|
// The second parameter omits the JS_Parse_Error constructor from the captured stack trace:
|
||||||
|
Error.captureStackTrace(this, JS_Parse_Error);
|
||||||
};
|
};
|
||||||
|
|
||||||
JS_Parse_Error.prototype.toString = function() {
|
JS_Parse_Error.prototype = Error.prototype;
|
||||||
return this.message + " (line: " + this.line + ", col: " + this.col + ", pos: " + this.pos + ")" + "\n\n" + this.stack;
|
|
||||||
};
|
|
||||||
|
|
||||||
function js_error(message, filename, line, col, pos) {
|
function js_error(message, filename, line, col, pos) {
|
||||||
throw new JS_Parse_Error(message, line, col, pos);
|
throw new JS_Parse_Error(message, line, col, pos);
|
||||||
|
|
|
||||||
|
|
@ -81,11 +81,15 @@ function repeat_string(str, i) {
|
||||||
return d;
|
return d;
|
||||||
};
|
};
|
||||||
|
|
||||||
function DefaultsError(msg, defs) {
|
function DefaultsError(message, defs) {
|
||||||
this.msg = msg;
|
this.message = message + "(defs: " + JSON.stringify(defs) + ")";
|
||||||
this.defs = defs;
|
this.defs = defs;
|
||||||
|
// The second parameter omits the DefaultError constructor from the captured stack trace:
|
||||||
|
Error.captureStackTrace(this, DefaultsError);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
DefaultsError.prototype = Error.prototype;
|
||||||
|
|
||||||
function defaults(args, defs, croak) {
|
function defaults(args, defs, croak) {
|
||||||
if (args === true)
|
if (args === true)
|
||||||
args = {};
|
args = {};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user