cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Beryozkin (JIRA)" <>
Subject [jira] [Commented] (CXF-7119) Introduce a JAX-RS client provider for catching technical exceptions (e.g. IOException)
Date Thu, 24 Nov 2016 11:16:58 GMT


Sergey Beryozkin commented on CXF-7119:

I've added this test in fault interceptor:

Note it throws ProcessingException directly which results in the test avoiding having to go
to the cause:;a=blob;f=systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/;h=da1f0468be30b184ec581cde187216b612f07426;hb=96f64799#l2645

But the interceptor can rethrow some custom exception in which case it will be wrapped in
Message has many other properties related to the current request too,

Also note this interceptor can be added before the proxy is created via JAXRSClientFactoryBean.

I think this issue will now need to be resolved with something like Works As Expected or similar
given that CXF already offers the loose mechanism to handle the technical exceptions 


> Introduce a JAX-RS client provider for catching technical exceptions (e.g. IOException)
> ---------------------------------------------------------------------------------------
>                 Key: CXF-7119
>                 URL:
>             Project: CXF
>          Issue Type: New Feature
>          Components: JAX-RS
>    Affects Versions: 3.1.3
>            Reporter: Jörg Hohwiller
>            Assignee: Sergey Beryozkin
>             Fix For: 3.2.0, 3.1.9
> When using CXF for REST/JAX-RS service clients I quickly noticed that I need to tweak
the error handling. My services use an ExceptionMapper that provides error details via JSON
result payload. Hence I want to access this and render an exception with further details and
more context information what works fine with ResponseExceptionMapper. 
> However, when a technical error (IOException such as unkown host, connection refused,
timeout, etc.) occurrs I only get generic errors from CXF client (org.apache.cxf.interceptor.Fault:
Could not send Message.). This is undesired but unfortunately my custom ResponseExceptionMapper
is never called for such technical errors. There seems to be no way to archive my goal with
CXF itself. I could only wrap the client again with a custom written dynamic proxy to reach
my goal.
> It seems that CXF hardwires this behaviour:
> It would be awesome if in such case ResponseExceptionMapper would also be applied so
I have the chance to interfere and produce better exceptions (e.g. with a message containing
the name of the application/microservice that could not be called, the URL, etc.) for my individual

This message was sent by Atlassian JIRA

View raw message