forked from codesandbox/codesandbox-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule-warning.ts
More file actions
37 lines (33 loc) · 1 KB
/
module-warning.ts
File metadata and controls
37 lines (33 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import TranspiledModule from '../transpiled-module';
import { WarningStructure } from '../transpilers/utils/worker-warning-handler';
export default class ModuleWarning extends Error {
constructor(module: TranspiledModule, warning: WarningStructure) {
super();
this.name = 'ModuleWarning';
this.path = warning.fileName || module.module.path;
this.message = warning.message;
this.warning = warning.message;
this.lineNumber = warning.lineNumber;
this.columnNumber = warning.columnNumber;
this.severity = warning.severity;
this.source = warning.source;
}
serialize(): WarningStructure {
return {
name: 'ModuleWarning',
message: this.message,
fileName: this.path,
lineNumber: this.lineNumber,
columnNumber: this.columnNumber,
source: this.source,
severity: this.severity,
};
}
path: string;
message: string;
warning: string;
severity: 'notice' | 'warning';
source?: string;
lineNumber?: number;
columnNumber?: number;
}