UNPKG

1.24 kBTypeScriptView Raw
1import type { LineCounter } from './parse/line-counter';
2export type ErrorCode = 'ALIAS_PROPS' | 'BAD_ALIAS' | 'BAD_DIRECTIVE' | 'BAD_DQ_ESCAPE' | 'BAD_INDENT' | 'BAD_PROP_ORDER' | 'BAD_SCALAR_START' | 'BLOCK_AS_IMPLICIT_KEY' | 'BLOCK_IN_FLOW' | 'DUPLICATE_KEY' | 'IMPOSSIBLE' | 'KEY_OVER_1024_CHARS' | 'MISSING_CHAR' | 'MULTILINE_IMPLICIT_KEY' | 'MULTIPLE_ANCHORS' | 'MULTIPLE_DOCS' | 'MULTIPLE_TAGS' | 'NON_STRING_KEY' | 'TAB_AS_INDENT' | 'TAG_RESOLVE_FAILED' | 'UNEXPECTED_TOKEN' | 'BAD_COLLECTION_TYPE';
3export type LinePos = {
4 line: number;
5 col: number;
6};
7export declare class YAMLError extends Error {
8 name: 'YAMLParseError' | 'YAMLWarning';
9 code: ErrorCode;
10 message: string;
11 pos: [number, number];
12 linePos?: [LinePos] | [LinePos, LinePos];
13 constructor(name: YAMLError['name'], pos: [number, number], code: ErrorCode, message: string);
14}
15export declare class YAMLParseError extends YAMLError {
16 constructor(pos: [number, number], code: ErrorCode, message: string);
17}
18export declare class YAMLWarning extends YAMLError {
19 constructor(pos: [number, number], code: ErrorCode, message: string);
20}
21export declare const prettifyError: (src: string, lc: LineCounter) => (error: YAMLError) => void;