You can implement ExceptionMapper, which returns everything you want. So, for example, it can put all exception from stacktrace in the answer.
Is this what you want on the client side? I'm not sure.
It can be quite a difficult task for a client to rebuild exceptions and modify it.
In addition, it is rather unsafe, since stacktrace will expose the internal server code to the client.
I suggest you declare some server error codes that make sense to the client and that you want to expose. Example:
- 1000 - database connection failure.
- 2000 - something else
So, for specific exceptions in ExceptionMapper, you can map server exceptions to error codes and then reassign them on the client side.
source share