feat: Convert error handler ts file to js file
This commit is contained in:
@@ -1,15 +1,7 @@
|
|||||||
import { NextFunction, Request, Response } from 'express';
|
|
||||||
import logger from './logger';
|
import logger from './logger';
|
||||||
|
|
||||||
import BaseError from '../errors/base';
|
|
||||||
|
|
||||||
// Do not remove `next` argument as the function signature will not fit for an error handler middleware
|
// Do not remove `next` argument as the function signature will not fit for an error handler middleware
|
||||||
const errorHandler = (
|
const errorHandler = (err, req, res, next) => {
|
||||||
err: BaseError,
|
|
||||||
req: Request,
|
|
||||||
res: Response,
|
|
||||||
next: NextFunction
|
|
||||||
): void => {
|
|
||||||
if (err.message === 'Not Found') {
|
if (err.message === 'Not Found') {
|
||||||
res.status(404).end();
|
res.status(404).end();
|
||||||
} else {
|
} else {
|
Reference in New Issue
Block a user