adds containment callbacks to over.app.Main

This commit is contained in:
Martinez 2017-05-02 02:22:06 +02:00
parent d1c88b2e73
commit 2c99c441ca
3 changed files with 15 additions and 12 deletions

View file

@ -420,6 +420,7 @@ class Main:
self.features = types.ndict() self.features = types.ndict()
self.last_command_line = None self.last_command_line = None
self.using_alternate_config = False self.using_alternate_config = False
self.uncontained_exception_callbacks = [] # (function, args)
for feature_name in self.default_features: for feature_name in self.default_features:
if feature_name in features: if feature_name in features:
@ -805,3 +806,13 @@ class Main:
except: except:
self.print("<R>failed to contain exception<.>", self.print.tl.epic) self.print("<R>failed to contain exception<.>", self.print.tl.epic)
traceback.print_exc() 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)

View file

@ -2,7 +2,7 @@
# encoding: utf-8 # encoding: utf-8
major = 1 # VERSION_MAJOR_IDENTIFIER major = 1 # VERSION_MAJOR_IDENTIFIER
minor = 99 # VERSION_MINOR_IDENTIFIER minor = 100 # VERSION_MINOR_IDENTIFIER
# VERSION_LAST_MM 1.99 # VERSION_LAST_MM 1.100
patch = 22 # VERSION_PATCH_IDENTIFIER patch = 0 # VERSION_PATCH_IDENTIFIER
str = "1.99.22" # VERSION_STRING_IDENTIFIER str = "1.100.0" # VERSION_STRING_IDENTIFIER

View file

@ -1,8 +0,0 @@
#! /usr/bin/env python3
# encoding: utf-8
major = 1 # VERSION_MAJOR_IDENTIFIER
minor = 4 # VERSION_MINOR_IDENTIFIER
# VERSION_LAST_MM 1.4
patch = 42 # VERSION_PATCH_IDENTIFIER
str = ".".join(str(v) for v in (major, minor, patch))