]> jfr.im git - erebus.git/commitdiff
further crashbug related to typo in module name, etc
authorzonidjan <redacted>
Sun, 6 Sep 2015 01:50:49 +0000 (20:50 -0500)
committerzonidjan <redacted>
Sun, 6 Sep 2015 01:50:49 +0000 (20:50 -0500)
ctlmod.py

index 73ae1fcd015d228180dc7ad8de64dc7a21f6072d..18876a0d30ed0d923e85b2460d7e6707a0242d09 100644 (file)
--- a/ctlmod.py
+++ b/ctlmod.py
@@ -12,8 +12,12 @@ def modhas(modname, attname): return getattr(modules[modname], attname, None) is
 
 def load(parent, modname):
        if not isloaded(modname):
-               mod = __import__(modname)
-               reload(mod)
+               try:
+                       mod = __import__(modname)
+                       reload(mod)
+               except BaseException as e: #we don't want even sys.exit() to crash us (in case of malicious module) so use BaseException
+                       return modlib.error(e)
+                       
 
                if not hasattr(mod, 'modinfo'):
                        return modlib.error('no modinfo')
@@ -61,7 +65,7 @@ def reloadmod(parent, modname):
 
                try:
                        return reload(modules[modname])
-               except BaseException, e:
+               except BaseException as e:
                        return modlib.error(e)
 
                if modhas(modname, 'modrestarted'): modules[modname].modrestarted(parent)