Skip to content
This repository has been archived by the owner on Mar 22, 2019. It is now read-only.

ApplicationExceptionFilter return 500 on nest version 4.6.5 #3

Closed
Dominic-Preap opened this issue Mar 5, 2018 · 1 comment
Closed

Comments

@Dominic-Preap
Copy link
Contributor

On version 4.6.5 updates say:

  • common: HttpException extends Error
  • microservices: RpcException extends Error
  • websockets: WsException extends Error

In your code base by checking instanceof Error will make every exception to status 500

if (err instanceof Error) {
      console.error(errTitle, err);
      const statusCode = HttpStatus.INTERNAL_SERVER_ERROR;
      res.status(statusCode).json({
        statusCode,
        message: 'Internal Server Error'
      });
    }
@chanlito
Copy link
Owner

chanlito commented Mar 7, 2018

fixed

@chanlito chanlito closed this as completed Mar 7, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants