-
Notifications
You must be signed in to change notification settings - Fork 66
Ability to read content after catching exception #29
Comments
Sounds good! From: davidekholm [email protected] As you may know, some RESTful servers provide additional information about an error in the http content, but with today's Resty implementation one simpy gets an IOException if there is a 500 server error. Now it's impossible to dig further as the IOException carries no further information :-( |
Great to hear from you. These changes won't affect any clients, just give the ability to inspect error details further. However, the attached code doesn't include my other addition, which enables the user to add and remove custom http headers. I recommend that you add that ability to the base class too. Here are the code snippets that I added to implement support for custom http headers. My additions in bold (Resty.html):
Regards On 7 sep 2013, at 20:14, Jochen Bedersdorfer [email protected] wrote:
|
Any chance that the exception handling changes will be folded into Resty? It would be really helpful. |
As you may know, some RESTful servers provide additional information about an error in the http content, but with today's Resty implementation one simpy gets an IOException if there is a 500 server error. Now it's impossible to dig further as the IOException carries no further information :-(
I've made a tiny and fully compatible adjustment to a subclass of Resty to handle this. I let Resty catch IOExeptions, and re-throw RestyExceptions instead. These RestyExceptions are simply subclasses of IOExceptions that embeds an AbstractResource. Problem solved :-)
I'd be happy to provide you my implementation. As I said, it's a tiny and fully compatible adjustment. It does not require any changes to existing users of your library. It just makes it better. My implementation also allows a user to add additional http request parameters which is required by some servers.
Just email me at [email protected] and I'll contribute my code!
The text was updated successfully, but these errors were encountered: