mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
also guard the ac_process_ffi_event calling
This commit is contained in:
@@ -244,7 +244,8 @@ class EventThread(threading.Thread):
|
|||||||
|
|
||||||
lib.dc_event_unref(event)
|
lib.dc_event_unref(event)
|
||||||
ffi_event = FFIEvent(name=evt_name, data1=data1, data2=data2)
|
ffi_event = FFIEvent(name=evt_name, data1=data1, data2=data2)
|
||||||
self.account._pm.hook.ac_process_ffi_event(account=self, ffi_event=ffi_event)
|
with self.swallow_and_log_exception("ac_process_ffi_event {}".format(ffi_event)):
|
||||||
|
self.account._pm.hook.ac_process_ffi_event(account=self, ffi_event=ffi_event)
|
||||||
for name, kwargs in self._map_ffi_event(ffi_event):
|
for name, kwargs in self._map_ffi_event(ffi_event):
|
||||||
hook = getattr(self.account._pm.hook, name)
|
hook = getattr(self.account._pm.hook, name)
|
||||||
info = "call {} kwargs={} failed".format(name, kwargs)
|
info = "call {} kwargs={} failed".format(name, kwargs)
|
||||||
|
|||||||
@@ -152,3 +152,25 @@ def test_logged_hook_failure(acfactory):
|
|||||||
assert "some" in str(cap)
|
assert "some" in str(cap)
|
||||||
assert "ZeroDivisionError" in str(cap)
|
assert "ZeroDivisionError" in str(cap)
|
||||||
assert "Traceback" in str(cap)
|
assert "Traceback" in str(cap)
|
||||||
|
|
||||||
|
|
||||||
|
def test_logged_ac_process_ffi_failure(acfactory):
|
||||||
|
from deltachat import account_hookimpl
|
||||||
|
|
||||||
|
ac1 = acfactory.get_unconfigured_account()
|
||||||
|
acfactory._acsetup.init_logging(ac1)
|
||||||
|
|
||||||
|
class FailPlugin:
|
||||||
|
@account_hookimpl
|
||||||
|
def ac_process_ffi_event(ffi_event):
|
||||||
|
0/0
|
||||||
|
|
||||||
|
ac1.add_account_plugin(FailPlugin())
|
||||||
|
cap = []
|
||||||
|
ac1.log = cap.append
|
||||||
|
# cause any event eg contact added/changed
|
||||||
|
ac1.create_contact("something@example.org")
|
||||||
|
assert cap
|
||||||
|
assert "ac_process_ffi_event" in str(cap)
|
||||||
|
assert "ZeroDivisionError" in str(cap)
|
||||||
|
assert "Traceback" in str(cap)
|
||||||
|
|||||||
Reference in New Issue
Block a user