[openstack-dev] [Review] Use of exception for non-exceptional cases

Monty Taylor mordred at inaugust.com
Fri Jul 12 15:20:05 UTC 2013



On 07/11/2013 05:43 AM, Thomas Hervé wrote:
> 
> 
> On Thu, Jul 11, 2013 at 1:49 AM, Monty Taylor <mordred at inaugust.com
> <mailto:mordred at inaugust.com>> wrote:
> 
>     I'd like top-post and hijack this thread for another exception related
>     thing:
> 
>     a) Anyone writing code such as:
> 
>     try:
>       blah()
>     except SomeException:
>       raise SomeOtherExceptionLeavingOutStackContextFromSomeException
> 
>     should be mocked ruthlessly.
> 
> 
> i don't think mocking is a good way to convey your point. Losing
> tracebacks is not great, but having an API raising random exceptions is
> probably worse. Can you develop?

Mocking is bad at many things, and email is a bad way to express
generalizations through exaggeration. I would almost certainly not
actually mock anyone.

I doubt very seriously that any of us here working on OpenStack lack the
ability to develop.

In response to your question though- I find that when the process of
debugging an error involves editing an installed library to remove an
improperly done exception translation so that I can actually see the
traceback and find the error, then someone has made the wrong choice in
their implementation of the library.



More information about the OpenStack-dev mailing list