mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-27 21:18:05 +09:00
52774bbe64
* wip * wip * wip * Update index.ts * Update gen-openapi-spec.ts * Update api.ja-JP.md * Fix * Improve doc * Update gen-openapi-spec.ts * Update redoc.html * Improve doc * Update gen-openapi-spec.ts * Improve doc * Update CHANGELOG.md
27 lines
727 B
TypeScript
27 lines
727 B
TypeScript
export class ApiError extends Error {
|
|
public message: string;
|
|
public code: string;
|
|
public id: string;
|
|
public kind: string;
|
|
public httpStatusCode?: number;
|
|
public info?: any;
|
|
|
|
constructor(e?: { message: string, code: string, id: string, kind?: 'client' | 'server', httpStatusCode?: number }, info?: any) {
|
|
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;
|
|
}
|
|
}
|