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

Juraci Paixão Kröhling jpkroehling at redhat.com
Fri Mar 6 05:07:55 EST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/06/2015 10:57 AM, Heiko W.Rupp wrote:
> We should all over the place
> 
> a) specifc exceptions for some of the more common cases like
> StuffNotFoundException(message)
> 
> b) add Exception mappers that deal with mapping that exception
> content to some sensible output depending on requested media type.

I think we should be a bit careful with blindly throwing exceptions
and mapping them to responses. Exceptions are more expensive than just
checking for an object's existence and, for a public service (SaaS),
this could be abused.

For scenarios where things were really expected to be there but
aren't, exceptions are fine. For scenarios where the user asked for
something that didn't exist, input checking and promptly returning a
404 makes more sense, IMO.

- - Juca.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBAgAGBQJU+Xx6AAoJECKM1e+fkPrXcjsH/2oX5F8HIcz9a29km8hSGBY2
/iPdHDmOA/WkdB/75T29oTdaVqKQkDonqHOsVC/GkBGNedJcWhnrdkN+08KZvseH
nED3e9EcKjY833jK1/1r4muPHNmDxGkE91AtsOGdQDo95ckDtqSH2qnJQns9GHZ5
qYohcKWFMZpD42upcYRaOyQTJBrN79WSwnoiijeTmb+OE4UoGIpRM/L2QS3lPcCq
4SMW2NuXJW06cm5OJTnfoc590JOf7fRkQakzA+W22GxE4INdkL95fQGS+Zoxp0cv
8ITUM4Ek1eyBc+LXMh0xB4P5mLGbiuoyD9l6oxC9w7vDOp8e2UGTRASdNiKwxSc=
=YcB3
-----END PGP SIGNATURE-----


More information about the hawkular-dev mailing list