hi Doug,
2014-02-04 Doug Hellmann <[email protected]>: > > > > On Tue, Feb 4, 2014 at 9:43 AM, Sylvain Bauza <[email protected]>wrote: > >> >> > If the exception has a "code" attribute, it is set as the status code for > the response. Otherwise, the status is set to 500 as a default. There are a > set of exception classes in wsme.exc that set the status code and can be > used as base classes for exceptions in the API controllers. > > The thing is that we raised our own Exceptions in our previous API which were properly rendered. Here, even when raising an exception from the controller, WSME "eats" the exception, takes the code and renders only the exc_info without the whole text. > The typical way to handle this is to catch underlying exceptions for > situations that are known to be likely (no such object, permission issue, > etc.) and re-raise an exception with a valid status code and useful > message. Unexpected exceptions then result in a 500. > > Well, that means we have to duplicate for each RPC call the try:except: statement while we previously implemented in Flask some way to catch any Exception and render appropriately [2]. AIUI, I will have to do some hackativity for managing the exc and properly render it on the middleware side... Thanks for the reply, Doug, really appreciated, -Sylvain [2] : https://github.com/stackforge/climate/blob/master/climate/api/utils.py#L78 > Doug > > > >> >> -Sylvain >> >> [1] https://github.com/stackforge/wsme/blob/master/wsmeext/pecan.py#L90 >> >> _______________________________________________ >> OpenStack-dev mailing list >> [email protected] >> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev >> >> > > _______________________________________________ > OpenStack-dev mailing list > [email protected] > http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev > >
_______________________________________________ OpenStack-dev mailing list [email protected] http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
