[Hawkular-dev] [metrics] Consistent error replies from REST API

Viliam Rockai vrockai at redhat.com
Fri Mar 6 04:37:39 EST 2015


Hello, 

Thanks for opening this issue again. I think we should follow a standard
here. Let me just copy-paste from my last email (Thread "REST ideas"):

Another REST issue we should agree on: The standard for error responses.
I've found, that there are several standards we can follow (or create
our own):
http://stackoverflow.com/a/14538774/3252949

In my opinion it's fine to stick with the JSON API:
http://jsonapi.org/format/#errors

or stick with even simpler google style guide:
https://google-styleguide.googlecode.com/svn/trunk/jsoncstyleguide.xml?showone=error#error


Viliam

On Thu, 2015-03-05 at 18:32 +0100, Thomas Segismont wrote:
> Hi,
> 
> There's a growing portion of application code in the metrics REST API 
> which returns errors (with whichever HTTP status) in the following form:
> 
> ====
> {"errorMsg": "blah"}
> ====
> 
> Whether this format is nice or suitable is not the purpose of this 
> message. I just want to draw your attention to the fact that being 
> consistent regarding error reporting is important.
> 
> In this regard, I've added a new ExceptionMapper for 
> org.jboss.resteasy.spi.ReaderException[2] instances. So now, not only 
> application errors conform to the format above, but also errors coming 
> from payload parsing.
> 
> Regards,
> Thomas
> 
> [1] 
> http://docs.jboss.org/resteasy/docs/3.0.9.Final/userguide/html_single/#builtinException
> _______________________________________________
> hawkular-dev mailing list
> hawkular-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hawkular-dev




More information about the hawkular-dev mailing list