mirror of https://github.com/webpack/webpack.git
refactor(ModuleError): upgrade to ES6 (#3695)
This commit is contained in:
parent
e968b5059b
commit
6a2840f104
|
|
@ -2,15 +2,20 @@
|
|||
MIT License http://www.opensource.org/licenses/mit-license.php
|
||||
Author Tobias Koppers @sokra
|
||||
*/
|
||||
function ModuleError(module, err) {
|
||||
Error.call(this);
|
||||
Error.captureStackTrace(this, ModuleError);
|
||||
this.name = "ModuleError";
|
||||
this.module = module;
|
||||
this.message = err;
|
||||
this.error = err;
|
||||
}
|
||||
module.exports = ModuleError;
|
||||
"use strict";
|
||||
|
||||
ModuleError.prototype = Object.create(Error.prototype);
|
||||
ModuleError.prototype.constructor = ModuleError;
|
||||
class ModuleError extends Error {
|
||||
|
||||
constructor(module, err) {
|
||||
super();
|
||||
if(Error.hasOwnProperty("captureStackTrace")) {
|
||||
Error.captureStackTrace(this, this.constructor);
|
||||
}
|
||||
this.name = "ModuleError";
|
||||
this.module = module;
|
||||
this.message = err;
|
||||
this.error = err;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = ModuleError;
|
||||
|
|
|
|||
Loading…
Reference in New Issue