Files
clarizen-lib/src/errors.ts
T
2026-06-04 12:09:45 -03:00

20 lines
504 B
TypeScript

import type { ClarizenErrorBody } from "./types.js";
export class ClarizenApiError extends Error {
readonly errorCode: string;
readonly referenceId?: string;
readonly status: number;
constructor(status: number, body: ClarizenErrorBody) {
super(body.message);
this.name = "ClarizenApiError";
this.status = status;
this.errorCode = body.errorCode;
this.referenceId = body.referenceId;
}
isSessionTimeout(): boolean {
return this.errorCode === "SessionTimeout";
}
}