Dear team,
This is a followup of a discussion in a past PR: https://github.com/spring-projects/spring-framework/pull/1956
The rest client exception contains a preview of the body, which is great, and it helps a lot to quickly diagnose errors.
Now, the stacktrace looks like this:
Caused by: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error: [no body]
at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:101)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:238)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:147)
I'd like to add the HTTP method and URL to the error, so that the stacktrace looks like this:
Caused by: org.springframework.web.client.HttpServerErrorException$InternalServerError: 500 Server Error after GET http://localhost:49709/status/server : [no body]
at org.springframework.web.client.HttpServerErrorException.create(HttpServerErrorException.java:101)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:238)
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:147)
Thank you!
Comment From: jerzykrlk
As far as I can see you can still make it happen in your own custom extension of DefaultResponseErrorHandler, right? It just wouldn't be out of the box.
I'm not sure if you're refering to making getErrorMessage
protected, or the entire PR?
Comment From: rstoyanchev
As far as I can see you can still make it happen in your own custom extension of DefaultResponseErrorHandler, right? It just >> wouldn't be out of the box.
I'm not sure if you're refering to making getErrorMessage protected, or the entire PR?
I'm talking about the call to the protected handleError method that is now bypassed.