@cerbos/core
Version:
Common types used by the Cerbos client libraries
66 lines • 2 kB
TypeScript
import type { PolicyStoreIntegrityViolation, StatusNotOK, ValidationError } 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: StatusNotOK;
/**
* Additional error details.
*/
readonly details: string;
/** @deprecated */
static fromJSON(text: string): NotOK;
/** @internal */
constructor(
/**
* The status code returned by the Cerbos policy decision point server.
*/
code: StatusNotOK,
/**
* 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[]);
}
/**
* Error thrown when disabling or deleting a policy violates the integrity of the store.
*/
export declare class PolicyStoreIntegrityViolated extends NotOK {
/**
* Details of the integrity violations for each policy ID.
*/
readonly violations: Record<string, PolicyStoreIntegrityViolation>;
/** @internal */
constructor(code: StatusNotOK, message: string,
/**
* Details of the integrity violations for each policy ID.
*/
violations: Record<string, PolicyStoreIntegrityViolation>, options?: ErrorOptions);
}
//# sourceMappingURL=external.d.ts.map