source: imaps-frontend/node_modules/babel-loader/lib/Error.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 781 bytes
Line 
1const STRIP_FILENAME_RE = /^[^:]+: /;
2const format = err => {
3 if (err instanceof SyntaxError) {
4 err.name = "SyntaxError";
5 err.message = err.message.replace(STRIP_FILENAME_RE, "");
6 err.hideStack = true;
7 } else if (err instanceof TypeError) {
8 err.name = null;
9 err.message = err.message.replace(STRIP_FILENAME_RE, "");
10 err.hideStack = true;
11 }
12 return err;
13};
14class LoaderError extends Error {
15 constructor(err) {
16 super();
17 const {
18 name,
19 message,
20 codeFrame,
21 hideStack
22 } = format(err);
23 this.name = "BabelLoaderError";
24 this.message = `${name ? `${name}: ` : ""}${message}\n\n${codeFrame}\n`;
25 this.hideStack = hideStack;
26 Error.captureStackTrace(this, this.constructor);
27 }
28}
29module.exports = LoaderError;
Note: See TracBrowser for help on using the repository browser.