[REST] More info instead 'Internal server Error'
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2012 09:47 AM
Hi all,
I noticed that the REST API answers whith and "500 Internal server error" for each type of error in the client request. Would it be possible to get more info about what's wrong instead of this generic response?
Thanks in advance.
Bye
Franco
I noticed that the REST API answers whith and "500 Internal server error" for each type of error in the client request. Would it be possible to get more info about what's wrong instead of this generic response?
Thanks in advance.
Bye
Franco
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2012 03:27 AM
The body of the response generally contains a stack trace of the problem… What other solution do you suggest? The response-message should describe the response-code (500 Internal server error)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2012 05:13 AM
The body of the response generally contains a stack trace of the problem
That sounds good, but how to get it in a Java Application using Restlet client? See this example:
private static ClientResource getClientResource(String uri) {
ClientResource clientResource = new ClientResource(uri);
clientResource.setChallengeResponse(ChallengeScheme.HTTP_BASIC,
"kermit",
"kermit");
return clientResource;
}
….
String uri = REST_URI + "process-instance/3251";
Representation response = getClientResource(uri)
.get(MediaType.APPLICATION_JSON); //ResourceException if process 3251 doesn't exist
In the above code I get a ResourceException that (I think) doesn't contain the body of the response.
Is there a way to get that boby with the Restlet client?
Another way to design the REST API would give a different error status, for example "404 - not found", if process doesn't exist.
Thank you very much.
Bye
Franco
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2012 05:18 AM
Not sure on how to get the body using Restlet, without it throwing an exception. You have a point, though about the 404 when the process ins not found. The REST-api doesn't follow pure rest-guidelines because it's not using the response-codes to the fullest potential, we need to look into this…
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2012 12:37 PM
The body of the response generally contains a stack trace of the problem
Are you sure? (See http://www.francolombardo.net/wp-content/uploads/500.png)
Anyway, as you said, I think that error response should be improved a bit.
Thanks.
Bye
Franco
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2012 04:34 AM
Indeed, error-handling should be looked at in the REST-api and also validate the error-response body: https://jira.codehaus.org/browse/ACT-1463
