Spring Rest Client Exception Handling

白昼怎懂夜的黑 提交于 2019-12-04 03:13:56

I found solution. HttpClientErrorException worked for me.

It has e.getResponseBodyAsString() function which returns ResponseBody.

phirzel

You might want to distinguish between:

HttpClientErrorException (HTTP-Status >=400) or HttpServerErrorException (HTTP-Status >= 500) or even RestClientException.

Further on there is a good doc about defining your own ErrorHandler, see this link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!