← Back to team overview

openlp-core team mailing list archive

Re: [Merge] lp:~phill-ridout/openlp/bug1098075_2.0 into lp:openlp/2.0

 

Review: Needs Fixing

12	+ raise Exception(u'user_canceled')

Don't use the generic Exception class when raising exceptions, it makes you write silly code like this:

27	+ except Exception as info:
28	+     if unicode(info) == u'user_canceled':
29	+         return
30	+     else:
31	+         raise

Instead, make use of a more specific exception, like TypeError, UnicodeError, or (as a last resort) make your own exception type, like UserCancelError.

However, in this particular case, I think it is wrong to use an exception. Exceptions are not meant to be used as flow control, they should be used when an error occurs. In this case, I would rather return None and make the parent function deal with the result either being a tuple or None.
-- 
https://code.launchpad.net/~phill-ridout/openlp/bug1098075_2.0/+merge/146309
Your team OpenLP Core is subscribed to branch lp:openlp/2.0.


References