How to change swagger response for exception

1.6k Views Asked by At

I am using spring boot with swagger for REST API services. The swagger returns the response in the following format when exception occurs

    {
  "timestamp": 1449742584285,
  "status": 500,
  "error": "Internal Server Error",
  "exception": "com.foo.exception.NotFoundException",
  "message": "User with id 1 not found",
  "path": "/user/1"
}

Instead of returning the detailed response I want to show only the message. Also all the time the server tkhrows an RuntimeException.

How to achieve swagger to retun only the message.

0

There are 0 best solutions below