|
@@ 117-133 (lines=17) @@
|
| 114 |
|
return error_catcher_wrap_function |
| 115 |
|
|
| 116 |
|
|
| 117 |
|
def error_catcher_savu(function): |
| 118 |
|
@wraps(function) |
| 119 |
|
def error_catcher_wrap_function(): |
| 120 |
|
try: |
| 121 |
|
return function() |
| 122 |
|
except Exception as e: |
| 123 |
|
err_msg_list = str(e).split() |
| 124 |
|
savu_error = True if len(err_msg_list) > 1 and err_msg_list[1] == 'ERROR:' else False |
| 125 |
|
|
| 126 |
|
if error_level == 0 and savu_error: |
| 127 |
|
print(e) |
| 128 |
|
elif error_level == 0: |
| 129 |
|
print(f"{type(e).__name__}: {e}") |
| 130 |
|
elif error_level == 1: |
| 131 |
|
traceback.print_exc(file=sys.stdout) |
| 132 |
|
|
| 133 |
|
return error_catcher_wrap_function |
| 134 |
|
|
| 135 |
|
|
| 136 |
|
def populate_plugins(error_mode=False, examples=False): |
|
@@ 97-112 (lines=16) @@
|
| 94 |
|
|
| 95 |
|
|
| 96 |
|
def error_catcher(function): |
| 97 |
|
@wraps(function) |
| 98 |
|
def error_catcher_wrap_function(content, args): |
| 99 |
|
try: |
| 100 |
|
return function(content, args) |
| 101 |
|
except Exception as e: |
| 102 |
|
err_msg_list = str(e).split() |
| 103 |
|
savu_error = True if len(err_msg_list) > 1 and err_msg_list[1] == 'ERROR:' else False |
| 104 |
|
|
| 105 |
|
if error_level == 0 and savu_error: |
| 106 |
|
print(e) |
| 107 |
|
elif error_level == 0: |
| 108 |
|
print(f"{type(e).__name__}: {e}") |
| 109 |
|
elif error_level == 1: |
| 110 |
|
traceback.print_exc(file=sys.stdout) |
| 111 |
|
|
| 112 |
|
return content |
| 113 |
|
|
| 114 |
|
return error_catcher_wrap_function |
| 115 |
|
|