Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

RestErrorHandler should not be limited to RestClientException #1002

@tbruyelle

Description

@tbruyelle

The RestTemplate doesn't throw only RestClientExceptions. In my case, when the mobile connection is lost, I can get a HttpMessageNotReadableException :

org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: recvfrom failed: ETIMEDOUT (Connection timed
                            out); nested exception is java.net.SocketException: recvfrom failed: ETIMEDOUT (Connection timed out)
                        E   at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal(MappingJacksonHttpMessageConverter.java:1
                           25)
                        E   at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:147)
                        E   at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:76)
                        E   at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:655)
                        E   at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(RestTemplate.java:641)
                        E   at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:484)
                        E   at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:447)
                        E   at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:422)

The exception is not catched and so my app crashes miserably.
Maybe AA should allow RestErrorHandler to catch all kinds of RuntimeExceptions ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions