summaryrefslogtreecommitdiff
path: root/shared/error.py
blob: c116d3e2daae7ae3a34904227ed9fd332074420d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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