25 lines
651 B
JavaScript
25 lines
651 B
JavaScript
export class ApiError extends Error {
|
|
message;
|
|
code;
|
|
id;
|
|
kind;
|
|
httpStatusCode;
|
|
info;
|
|
constructor(e, info){
|
|
if (e == null) e = {
|
|
message: "Internal error occurred. Please contact us if the error persists.",
|
|
code: "INTERNAL_ERROR",
|
|
id: "5d37dbcb-891e-41ca-a3d6-e690c97775ac",
|
|
kind: "server",
|
|
httpStatusCode: 500
|
|
};
|
|
super(e.message);
|
|
this.message = e.message;
|
|
this.code = e.code;
|
|
this.id = e.id;
|
|
this.kind = e.kind || "client";
|
|
this.httpStatusCode = e.httpStatusCode;
|
|
this.info = info;
|
|
}
|
|
}
|