Files
languageservices/actions-workflow-parser/src/templates/template-validation-error.ts
T
2023-01-09 19:02:19 -05:00

26 lines
584 B
TypeScript

import {TokenRange} from "./tokens/token-range";
/**
* Provides information about an error which occurred during validation
*/
export class TemplateValidationError {
constructor(
public readonly rawMessage: string,
public readonly prefix: string | undefined,
public readonly code: string | undefined,
public readonly range: TokenRange | undefined
) {}
public get message(): string {
if (this.prefix) {
return `${this.prefix}: ${this.rawMessage}`;
}
return this.rawMessage;
}
public toString(): string {
return this.message;
}
}