Skip to content

Commit

Permalink
refactor handleError in ControllerBase to response as json (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtg7784 authored May 3, 2024
1 parent c274d9b commit e9b7f5f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/controllers/ControllerBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { Response } from 'express';
export class ControllerBase {
protected handleError(res: Response, err: Error) {
const ERROR_STATUS = 500;
res.status(ERROR_STATUS).send(err.message);
res.status(ERROR_STATUS).json({
message: err.message,
});
}

protected handleNotFound(res: Response) {
Expand Down

0 comments on commit e9b7f5f

Please sign in to comment.