@mapbox/mapbox-gl-style-spec
Version:
a specification for mapbox gl styles
19 lines (14 loc) • 686 B
text/typescript
// Note: Do not inherit from Error. It breaks when transpiling to ES5.
export default class ValidationError {
message: string;
identifier: string | null | undefined;
line: number | null | undefined;
constructor(key: string | null | undefined, value: (string | number | boolean) & {__line__?: number} | null | undefined, message: string, identifier?: string | null) {
this.message = (key ? `${key}: ` : '') + message;
if (identifier) this.identifier = identifier;
if (value !== null && value !== undefined && value.__line__) {
this.line = value.__line__;
}
}
}
export class ValidationWarning extends ValidationError {}