export class KastellError extends Error {
    code;
    hint;
    constructor(message, options) {
        super(message, { cause: options?.cause });
        this.name = this.constructor.name;
        this.code = options?.code ?? this.constructor.name.toUpperCase().replace("ERROR", "");
        this.hint = options?.hint;
        Object.setPrototypeOf(this, new.target.prototype);
    }
}
export function extractReason(reason) {
    return reason instanceof Error ? reason.message : String(reason);
}
export class TransientError extends KastellError {
}
export class ValidationError extends KastellError {
}
export class BusinessError extends KastellError {
}
export class PermissionError extends KastellError {
}
//# sourceMappingURL=errors.js.map