Skip to content

Commit 49a3172

Browse files
authored
Merge pull request webpack#3677 from willmendesneto/refactor-chunk-render-error
refactor(ChunkRenderError): upgrade to ES6
2 parents 09b90c1 + 8d6c8fc commit 49a3172

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

lib/ChunkRenderError.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5-
function ChunkRenderError(chunk, file, error) {
6-
Error.call(this);
7-
Error.captureStackTrace(this, ChunkRenderError);
8-
this.name = "ChunkRenderError";
9-
this.error = error;
10-
this.message = error.message;
11-
this.details = error.stack;
12-
this.file = file;
13-
this.chunk = chunk;
5+
"use strict";
6+
7+
class ChunkRenderError extends Error {
8+
9+
constructor(chunk, file, error) {
10+
super();
11+
12+
if(Error.hasOwnProperty("captureStackTrace")) {
13+
Error.captureStackTrace(this, this.constructor);
14+
}
15+
16+
this.name = "ChunkRenderError";
17+
this.error = error;
18+
this.message = error.message;
19+
this.details = error.stack;
20+
this.file = file;
21+
this.chunk = chunk;
22+
}
1423
}
15-
module.exports = ChunkRenderError;
1624

17-
ChunkRenderError.prototype = Object.create(Error.prototype);
18-
ChunkRenderError.prototype.constructor = ChunkRenderError;
25+
module.exports = ChunkRenderError;

0 commit comments

Comments
 (0)