DoRest - possible bug in handling error responses?

Beiträge: 5
Registriert: 26. Okt 2011 01:56

DoRest - possible bug in handling error responses?

Beitrag von mplomer »


I ran into a problem with handling error cases and mapping them to appropriate response codes. The approach we use is to signal error conditions by raising ResponseExceptions wrapping the appropriate ErrorResponse. I assume this is correct so far?

The problem is that this approach does not work with PUT / POST / PATCH methods, since these are handled by the RESTInterfaces handleRequestResponse() method. Now, this method wraps further handler execution in a generic try / catch block that maps ANY exception to a BadRequest. In contrast, createResponse() (which handles GET / HEAD) does not guard for exceptions and lets them bubble up to JDKServer.DoRestHandler.handle(), where the ErrorResponse is properly extracted.

While the RESTInterface feels like the correct place to handle exception-to-response mapping rather than doing it in a provider-specific place like JDKServer, the latter seems to at least implement it correctly.

Then again, maybe our approach is wrong?


Beiträge: 448
Registriert: 25. Sep 2007 12:12

Re: DoRest - possible bug in handling error responses?

Beitrag von eichberg »

The "bug" is now fixed. Just download the current release of DoRest.


Zurück zu „Archiv“