DEV Community

Discussion on: What to Except When You're Excepting: Python error handling dos & don'ts

 
khuongduybui profile image
Duy K. Bui

So

def wrap_foo:
    try:
        foo
    catch FooException:
        print "foo"

def wrap_bar:
    # same as above

def main:
    wrap_foo
    wrap_bar

Am I getting there?

Thread Thread
 
swizzard profile image
sam

yeah, depending on what you're trying to do—if everything's decoupled and bar doesn't depend on the success of foo, then this approach is the way to go