fix: Stop returning UNKNOWN ERROR in the response if an actual error message is available (#4859)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™ 2022-12-08 13:32:33 +01:00 committed by GitHub
parent 5156328c34
commit 4cb4c5e818
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,7 +133,7 @@ export function sendErrorResponse(res: Response, error: Error) {
const response: ErrorResponse = {
code: 0,
message: 'Unknown error',
message: error.message ?? 'Unknown error',
};
if (error instanceof ResponseError) {
@ -141,7 +141,6 @@ export function sendErrorResponse(res: Response, error: Error) {
console.error(picocolors.red(error.httpStatusCode), error.message);
}
response.message = error.message;
httpStatusCode = error.httpStatusCode;
if (error.errorCode) {