mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-18 08:35:10 +00:00
29 lines
688 B
TypeScript
29 lines
688 B
TypeScript
type OpenAPIParseErrorCode =
|
|
| 'invalid'
|
|
| 'parse-v2-in-v3'
|
|
| 'v2-conversion'
|
|
| 'dereference'
|
|
| 'yaml-parse';
|
|
|
|
/**
|
|
* Error thrown when the OpenAPI document is invalid.
|
|
*/
|
|
export class OpenAPIParseError extends Error {
|
|
public override name = 'OpenAPIParseError';
|
|
public code: OpenAPIParseErrorCode;
|
|
public rootURL: string | null;
|
|
|
|
constructor(
|
|
message: string,
|
|
options: {
|
|
code: OpenAPIParseErrorCode;
|
|
rootURL?: string | null;
|
|
cause?: Error;
|
|
}
|
|
) {
|
|
super(message, { cause: options.cause });
|
|
this.code = options.code;
|
|
this.rootURL = options.rootURL ?? null;
|
|
}
|
|
}
|