UNPKG

@cerbos/core

Version:
54 lines 1.52 kB
import type { ValidationError } from "./types/external.js"; import { Status } from "./types/external.js"; /** * Options for creating an error. */ export interface ErrorOptions { /** * The original error that caused this one. */ cause?: unknown; } /** * Error thrown when the Cerbos policy decision point server returns an unsuccessful response. */ export declare class NotOK extends Error { /** * The status code returned by the Cerbos policy decision point server. */ readonly code: Exclude<Status, Status.OK>; /** * Additional error details. */ readonly details: string; /** * Parse a JSON-serialized unsuccessful response. */ static fromJSON(text: string): NotOK; /** @internal */ constructor( /** * The status code returned by the Cerbos policy decision point server. */ code: Exclude<Status, Status.OK>, /** * Additional error details. */ details: string, options?: ErrorOptions); } /** * Error thrown when input fails schema validation, if the {@link Client} is configured with {@link Options.onValidationError | onValidationError} set to `"throw"`. */ export declare class ValidationFailed extends Error { /** * The validation errors that occurred. */ readonly validationErrors: ValidationError[]; /** @internal */ constructor( /** * The validation errors that occurred. */ validationErrors: ValidationError[]); } //# sourceMappingURL=errors.d.ts.map