adds containment callbacks to over.app.Main
This commit is contained in:
parent
d1c88b2e73
commit
2c99c441ca
3 changed files with 15 additions and 12 deletions
11
over/app.py
11
over/app.py
|
@ -420,6 +420,7 @@ class Main:
|
|||
self.features = types.ndict()
|
||||
self.last_command_line = None
|
||||
self.using_alternate_config = False
|
||||
self.uncontained_exception_callbacks = [] # (function, args)
|
||||
|
||||
for feature_name in self.default_features:
|
||||
if feature_name in features:
|
||||
|
@ -805,3 +806,13 @@ class Main:
|
|||
except:
|
||||
self.print("<R>failed to contain exception<.>", self.print.tl.epic)
|
||||
traceback.print_exc()
|
||||
|
||||
if self.uncontained_exception_callbacks:
|
||||
self.print("executing containment callbacks", self.print.tl.exec)
|
||||
l = len(self.uncontained_exception_callbacks)
|
||||
|
||||
for i, (cb, ctx) in enumerate(self.uncontained_exception_callbacks):
|
||||
self.print("(%d/%d) %s" %(i+1, l, cb.__name__))
|
||||
cb(*ctx)
|
||||
|
||||
self.print("containment callbacks executed", self.print.tl.done)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue