refactor: use promise.mapSeries

This commit is contained in:
harttle
2016-11-01 22:24:56 +08:00
parent f8269f4d20
commit 951225fb75
13 changed files with 103 additions and 124 deletions
+40
View File
@@ -0,0 +1,40 @@
function TokenizationError(message, input, line) {
if(Error.captureStackTrace){
Error.captureStackTrace(this, this.constructor);
}
this.name = this.constructor.name;
this.message = message;
this.input = input;
this.line = line;
}
TokenizationError.prototype = Object.create(Error.prototype);
TokenizationError.prototype.constructor = TokenizationError;
function ParseError(message, input, line, e) {
if(Error.captureStackTrace){
Error.captureStackTrace(this, this.constructor);
}
this.name = this.constructor.name;
this.originalError = e;
this.message = message;
this.input = input;
this.line = line;
}
ParseError.prototype = Object.create(Error.prototype);
ParseError.prototype.constructor = ParseError;
function RenderBreak(message){
if(Error.captureStackTrace){
Error.captureStackTrace(this, this.constructor);
}
this.name = this.constructor.name;
this.message = message;
}
RenderBreak.prototype = Object.create(Error.prototype);
RenderBreak.prototype.constructor = RenderBreak;
module.exports = {
TokenizationError, ParseError, RenderBreak
};