commercetools / commercetools/connect-application-kit

error.middleware.ts does not work properly without next parameter

Open
#85 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12
Forks
5
PR merge metrics
No merged PRs in 30d

Description

Currently, the error middleware has the following code:

```typescript
import { ErrorRequestHandler, Request, Response } from 'express';
import CustomError from '../errors/custom.error';

export const errorMiddleware: ErrorRequestHandler = (
error: Error,
_: Request,
res: Response
) =>

When I run the code with an error, the error middleware does not get called. The signature must conform to what they expect. To make it runnable I suggest the following changes:

```typescript
import { ErrorRequestHandler, NextFunction, Request, Response } from 'express';
import CustomError from '../errors/custom.error';

export const errorMiddleware: ErrorRequestHandler = (
error: Error,
_: Request,
res: Response,
next: NextFunction
) => {
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.