diff options
author | mathieui <mathieui@mathieui.net> | 2019-08-23 12:31:20 +0200 |
---|---|---|
committer | Maxime “pep” Buquet <pep@bouah.net> | 2019-12-27 18:57:33 +0100 |
commit | 5a1a2e6c18280cf505bacc051e9b539bdd5fcf0c (patch) | |
tree | 0bfbb596b78af79d631f8bf77e12e3bfa970cd42 /poezio/plugin.py | |
parent | 33a1519a3914906566de656daa63a5a778cf3a5b (diff) | |
download | poezio-5a1a2e6c18280cf505bacc051e9b539bdd5fcf0c.tar.gz poezio-5a1a2e6c18280cf505bacc051e9b539bdd5fcf0c.tar.bz2 poezio-5a1a2e6c18280cf505bacc051e9b539bdd5fcf0c.tar.xz poezio-5a1a2e6c18280cf505bacc051e9b539bdd5fcf0c.zip |
Add a "passthrough" parameter for calls through the safetymetaclass
So errors don’t get caught
Diffstat (limited to 'poezio/plugin.py')
-rw-r--r-- | poezio/plugin.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/poezio/plugin.py b/poezio/plugin.py index c3d10b38..61e0ea87 100644 --- a/poezio/plugin.py +++ b/poezio/plugin.py @@ -75,9 +75,12 @@ class SafetyMetaclass(type): @staticmethod def safe_func(f): def helper(*args, **kwargs): + passthrough = kwargs.pop('passthrough', False) try: return f(*args, **kwargs) except: + if passthrough: + raise if inspect.stack()[1][1] == inspect.getfile(f): raise elif SafetyMetaclass.core: @@ -86,9 +89,12 @@ class SafetyMetaclass(type): 'Error') return None async def async_helper(*args, **kwargs): + passthrough = kwargs.pop('passthrough', False) try: return await f(*args, **kwargs) except: + if passthrough: + raise if inspect.stack()[1][1] == inspect.getfile(f): raise elif SafetyMetaclass.core: |