On Wed, Jun 6, 2018 at 12:36 PM, Michael Vorburger <vorbur...@redhat.com>
wrote:

> Tom, Stephen, anyone else who wants to chime in on this on controller-dev
> (not because this is particularly specific to controller-dev, just thought
> of others on this list; also somewhere in netconf/restconf there must be
> something similar, how is the same handled there?),
>
> Two Qs re. my WIP (!) in https://git.opendaylight.org/gerrit/#/c/72735/ :
>
> 1. does what I have there so far look about right to you? (More from a
> general "how to correctly do exception handling in Java" than neutron PoV
> ...)
>
> 2. with this, I have a 159 errors in all of those JAX RS @Path annotated
> classes with their @GET @Produces @StatusCodes kind of methods. What's the
> right thing to do in JAX RS re. the 
> ReadFailedException/OperationFailedException
> which (now) need to be handled? Is it:
>
> a) just add "throws OperationFailedException" to all those JAX RS
> methods? Will JAX RS catch and both slf4j log and return a HTTP 500 with
> exception in body response?
>
> b) catch and rethrow, 159 times, as a javax.ws.rs.WebApplicationException?
> Or subclass of it, similar to the 
> org.opendaylight.neutron.northbound.api.ResourceNotFoundException,
> creating a say org.opendaylight.neutron.northbound.api.
> DatastoreOperationFailedWebApplicationException kind of class?
>

Subclass WebApplicationException - DatastoreOperationFailedException. I
would have the CRUD APIs throw this instead of ReadFailedException etc.
Since it would be unchecked, you wouldn't have to change 159 call sites.


>
> c) catch and return Response.status(500) myself? 159 times?
>
> Tx,
> M.
> --
> Michael Vorburger, Red Hat
> vorbur...@redhat.com | IRC: vorburger @freenode | ~ = http://vorburger.ch
>
_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to