Merge pull request #3677 from willmendesneto/refactor-chunk-render-error

refactor(ChunkRenderError): upgrade to ES6
This commit is contained in:
Tobias Koppers 2017-01-02 12:48:37 +01:00 committed by GitHub
commit 49a31729ae
1 changed files with 20 additions and 13 deletions

View File

@ -2,17 +2,24 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
function ChunkRenderError(chunk, file, error) {
Error.call(this);
Error.captureStackTrace(this, ChunkRenderError);
this.name = "ChunkRenderError";
this.error = error;
this.message = error.message;
this.details = error.stack;
this.file = file;
this.chunk = chunk;
}
module.exports = ChunkRenderError;
"use strict";
ChunkRenderError.prototype = Object.create(Error.prototype);
ChunkRenderError.prototype.constructor = ChunkRenderError;
class ChunkRenderError extends Error {
constructor(chunk, file, error) {
super();
if(Error.hasOwnProperty("captureStackTrace")) {
Error.captureStackTrace(this, this.constructor);
}
this.name = "ChunkRenderError";
this.error = error;
this.message = error.message;
this.details = error.stack;
this.file = file;
this.chunk = chunk;
}
}
module.exports = ChunkRenderError;