cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iris ding <irisdin...@gmail.com>
Subject Throw Error in ExceptionMapper
Date Tue, 12 Aug 2014 02:34:29 GMT
Hi Guys,

In ExceptionUtils.convertFaultToResponse(), it only catches Exception.  So
CXF fails to process the request if we throw Error in our own
XXXExceptionMapper. The definition of ExceptionMapper is:
Interface ExceptionMapper<E extends Throwable> So I think we should catch
Throwable instead.

   if (response == null) {
            ExceptionMapper<T>  mapper =
               
ServerProviderFactory.getInstance(inMessage).createExceptionMapper(ex.getClass(),
inMessage);
            if (mapper != null) {
                try {
                    response = mapper.toResponse(ex);
                } catch (Exception mapperEx) {
                   
inMessage.getExchange().put(JAXRSUtils.EXCEPTION_FROM_MAPPER, "true");
                    mapperEx.printStackTrace();
                    return Response.serverError().build();
                }
            }
        }
        }

What do you think about this problem? 

Thanks.
Iris Ding



--
View this message in context: http://cxf.547215.n5.nabble.com/Throw-Error-in-ExceptionMapper-tp5747662.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Mime
View raw message