You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
529 B
19 lines
529 B
// @flow
|
|
|
|
// Note: Do not inherit from Error. It breaks when transpiling to ES5.
|
|
|
|
export default class ValidationError {
|
|
message: string;
|
|
identifier: ?string;
|
|
line: ?number;
|
|
|
|
constructor(key: ?string, value: ?{ __line__: number }, message: string, identifier: ?string) {
|
|
this.message = (key ? `${key}: ` : '') + message;
|
|
if (identifier) this.identifier = identifier;
|
|
|
|
if (value !== null && value !== undefined && value.__line__) {
|
|
this.line = value.__line__;
|
|
}
|
|
}
|
|
}
|