InternalServerErrorHandler.ts 529 B

12345678910111213
  1. import { Middleware, StatusCodes, Request, Response, NextFunction } from '../base/http';
  2. import { $$ } from '../base/i18n';
  3. class InternalServerErrorHandler extends Middleware {
  4. protected order = 10000;
  5. protected route = null;
  6. protected action = (err: Error, req: Request, res: Response, next: NextFunction): any => {
  7. this.context.logError(`${err.message}: ${err.stack}`);
  8. res.status(StatusCodes.INTERNAL_SERVER_ERROR).send($$('org.crazydoctor.expressts.httpError.500'));
  9. };
  10. }
  11. export default InternalServerErrorHandler;