def attempt() raises: try: raise Error("sensor fault") except e: print("logging:", e) def main(): try: attempt() except: print("recovered")