Skip to content

Commit 8fd6704

Browse files
committed
build error solved
1 parent 1021f4d commit 8fd6704

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/global-error-handler.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Request, Response, NextFunction } from 'express';
1+
import { ErrorRequestHandler } from 'express';
22
import { StatusCodes, getStatusMessage } from 'http-status-toolkit';
33
import { isCustomAPIError } from './checking-custom-api-error';
44
import { CustomAPIError } from './error';
@@ -38,15 +38,11 @@ export function setErrorOptions(options: Partial<ErrorOptions>) {
3838

3939

4040

41-
export const globalErrorHandler = (
42-
err: unknown,
43-
_req: Request,
44-
res: Response,
45-
_next: NextFunction
46-
) => {
41+
export const globalErrorHandler: ErrorRequestHandler = (err, _req, res, _next) => {
4742
// Ignoring harmless favicon.ico errors
4843
if (_req.originalUrl === '/favicon.ico') {
49-
return res.status(204).end();
44+
res.status(204).end();
45+
return;
5046
}
5147

5248
let statusCode: number = StatusCodes.INTERNAL_SERVER_ERROR;

0 commit comments

Comments
 (0)