diff options
author | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 10:39:49 +0200 |
---|---|---|
committer | AL-LCL <alvin@alvinhavel.com> | 2023-05-19 10:39:49 +0200 |
commit | 58ebd3bc0f00c532e97e9a5571471ffab87934ba (patch) | |
tree | 6e099e59af07206df6edf2b0c585d0c5a466d4bd /shared/error.py |
Diffstat (limited to 'shared/error.py')
-rw-r--r-- | shared/error.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/shared/error.py b/shared/error.py new file mode 100644 index 0000000..c116d3e --- /dev/null +++ b/shared/error.py @@ -0,0 +1,35 @@ +''' + Error decorators to not disrupt the + general flow of either client or server + during runtime. + + Verified: 2021 February 8 + * Follows PEP8 + * Tested Platforms + * Windows 10 +''' + +import sys + + +class Error: + + @staticmethod + def quiet(callback): + def wrapper(*args, **kwargs): + try: + return callback(*args, **kwargs) + except Exception: + pass + + return wrapper + + @staticmethod + def quiet_thread(callback): + def wrapper(*args, **kwargs): + try: + callback(*args, **kwargs) + except Exception: + sys.exit() + + return wrapper |