On 05/09/12 13:49, Marek Potociar wrote:
>
> On Sep 4, 2012, at 6:25 PM, Sergey Beryozkin<sberyozkin_at_talend.com> wrote:
>
>> ClientException is meant to represent client-specific exceptions, MessageProcessingException - exceptions caused during reading the response entity.
>>
>> I'd like to note that IMHO the way exceptions can be managed in 2.0 looks very good, but a bit of clarification/update might be needed.
>>
>> The question is what to expect in the case such as:
>>
>> target.request("text/xml").get(Book.class); where no MBR is actually available on the client side. I think it should be:
>>
>> try {
>>
>> target.request("text/xml").get(Book.class);
>>
>> } catch (ClientException ex) {
>>
>> assertTrue(ex.getCause() instanceof MessageProcessingException);
>>
>> }
>>
>> Do you all agree with the above ?
>
> I do.
>
>>
>> Assuming yes, I'd also like to suggest adding one more constructor to ClientException, the one accepting Response - this might in principle allow for read retries when no MBR is available, example:
>>
>> try {
>>
>> target.request("text/xml").get(Book.class);
>>
>> } catch (ClientException ex) {
>>
>> Response r = ex.getResponse();
>> LOG.info("String content: " + r.readEntity(String.class));
>>
>> }
>
> I'd prefer we keep ClientException pure processing exception (that is response-less) as it may be thrown during the request processing when no response is available. If there's a strong use case for the above, I'd prefer we instead introduce a different exception or try to come up with some generic changes for MessageProcessingException.
>
Sure - this indeed can be revisited on demand...
Cheers, Sergey
> Marek
>
>>
>> Cheers, Sergey
>