forked from FoundKeyGang/FoundKey
server: fix ReferenceError
The super constructor has to be called before accessing this.
This commit is contained in:
parent
eb1ecd90e6
commit
240ad1cca6
1 changed files with 4 additions and 5 deletions
|
@ -9,15 +9,14 @@ export class ApiError extends Error {
|
||||||
info?: any | null,
|
info?: any | null,
|
||||||
) {
|
) {
|
||||||
if (!(code in errors)) {
|
if (!(code in errors)) {
|
||||||
this.info = `Unknown error "${code}" occurred.`;
|
info = `Unknown error "${code}" occurred.`;
|
||||||
this.code = 'INTERNAL_ERROR';
|
code = 'INTERNAL_ERROR';
|
||||||
} else {
|
|
||||||
this.info = info;
|
|
||||||
this.code = code;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { message, httpStatusCode } = errors[this.code];
|
const { message, httpStatusCode } = errors[this.code];
|
||||||
super(message);
|
super(message);
|
||||||
|
this.code = code;
|
||||||
|
this.info = info;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.httpStatusCode = httpStatusCode;
|
this.httpStatusCode = httpStatusCode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue