mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-12 05:48:57 +00:00
a3855257c8
Co-authored-by: Nicolas Dorseuil <nicolas@gitbook.io>
33 lines
886 B
TypeScript
33 lines
886 B
TypeScript
import type { ErrorObject } from '@scalar/openapi-parser';
|
|
|
|
export 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;
|
|
public errors: ErrorObject[] | undefined;
|
|
constructor(
|
|
message: string,
|
|
options: {
|
|
code: OpenAPIParseErrorCode;
|
|
rootURL?: string | null;
|
|
cause?: Error;
|
|
errors?: ErrorObject[] | undefined;
|
|
}
|
|
) {
|
|
super(message, { cause: options.cause });
|
|
this.code = options.code;
|
|
this.rootURL = options.rootURL ?? null;
|
|
this.errors = options.errors;
|
|
}
|
|
}
|