|
2 | 2 | MIT License http://www.opensource.org/licenses/mit-license.php |
3 | 3 | Author Tobias Koppers @sokra |
4 | 4 | */ |
5 | | -function ModuleNotFoundError(module, err, dependencies) { |
6 | | - Error.call(this); |
7 | | - Error.captureStackTrace(this, ModuleNotFoundError); |
8 | | - this.name = "ModuleNotFoundError"; |
9 | | - this.message = "Module not found: " + err; |
10 | | - this.details = err.details; |
11 | | - this.missing = err.missing; |
12 | | - this.module = module; |
13 | | - this.origin = module; |
14 | | - this.dependencies = dependencies; |
15 | | - this.error = err; |
| 5 | +"use strict"; |
| 6 | + |
| 7 | +class ModuleNotFoundError extends Error { |
| 8 | + constructor(module, err, dependencies) { |
| 9 | + console.log(module, err, dependencies); |
| 10 | + super(); |
| 11 | + if(Error.hasOwnProperty("captureStackTrace")) { |
| 12 | + Error.captureStackTrace(this, this.constructor); |
| 13 | + } |
| 14 | + this.name = "ModuleNotFoundError"; |
| 15 | + this.message = "Module not found: " + err; |
| 16 | + this.details = err.details; |
| 17 | + this.missing = err.missing; |
| 18 | + this.module = module; |
| 19 | + this.origin = module; |
| 20 | + this.dependencies = dependencies; |
| 21 | + this.error = err; |
| 22 | + } |
16 | 23 | } |
17 | | -module.exports = ModuleNotFoundError; |
18 | 24 |
|
19 | | -ModuleNotFoundError.prototype = Object.create(Error.prototype); |
20 | | -ModuleNotFoundError.prototype.constructor = ModuleNotFoundError; |
| 25 | +module.exports = ModuleNotFoundError; |
0 commit comments