Exceptions versus sys.exit()

Vlad Skvortsov vss at 73rus.com
Fri Apr 6 12:45:31 PDT 2007


Ivan Glushkov wrote:
> Hi.
>
> I just want to know what method to signal about error is preferred?
> Exceptions or simple sys.exit(1) (=  DITrack.Util.common.err()).
>   

I guess the rule of thumb is: exit if the error is fatal AND you're sure 
noone would like to catch it above in the execution stack. This means 
that most errors in libraries should be exceptions really. I didn't take 
a look at the code here, but I guess if this rule is broken, it's just 
because we wanted something to work right away, not to be coded "the 
right way".

-- 
Vlad Skvortsov, vss at 73rus.com, http://vss.73rus.com



More information about the Dev mailing list