first commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
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";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user