python decorator for error handling

Solutions on MaxInterview for python decorator for error handling by the best coders in the world

showing results for - "python decorator for error handling"
Gustave
30 May 2019
1def safe_run(func):
2
3    def func_wrapper(*args, **kwargs):
4
5        try:
6           return func(*args, **kwargs)
7
8        except Exception as e:
9
10            print(e)
11            return None
12
13    return func_wrapper
14
15
16