Skip to content

Commit

Permalink
(fix) log error only if unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
driiftkiing committed Jun 12, 2023
1 parent a8634e7 commit 5201659
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/api/src/api/v1/verse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ verse.get(
verses,
});
} catch (err) {
console.error(err);

let statusCode = 500;
let message = 'An error has occurred';

if (err instanceof AxiosError && err.response) {
statusCode = err.response.status || statusCode;
message = err.response.data || message;
} else {
console.error(err);
}

return res.status(statusCode).send({statusCode, message});
Expand Down

0 comments on commit 5201659

Please sign in to comment.