Created
February 20, 2023 15:27
-
-
Save chiendo97/d53994d4e9cc48d4a4f299131e1fc8d7 to your computer and use it in GitHub Desktop.
catch_exception
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def catch_exception(func): | |
def inner_function(*args, **kwargs): | |
# return func(*args, **kwargs) | |
try: | |
return func(*args, **kwargs) | |
except grpc._channel._InactiveRpcError as e: | |
# print(e.details()) | |
# print(args, kwargs) | |
args[2].abort(e.code(), details=f"Greeter:{func.__name__} -> {e.details()}") | |
# raise Exception(f"Greeter: {e.code()}-{e.details()}") | |
return inner_function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment