try catch - If exception retry in Python -
how go doing this
- try something.
- if works, great, continue normal flow.
- if fails run function , try again.
- if once again fails throw exception , stop code.
i believe have make use of try
haven't quite come around yet how use in particular example.
try nested try catch
:
try: do_something() #if works, skip rest , continue except: do_fix_function() #on error, function try: do_something() #try again except: throw error() #if fails time, stop , throw error
note if do_fix_function()
can fail, might want put inside second try statement instead
Comments
Post a Comment