mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-10 20:22:36 +01:00
Robustified\!
This commit is contained in:
parent
a7c7cc2841
commit
5e3fae4dbb
@ -66,19 +66,31 @@ def main():
|
||||
import schedule
|
||||
schedule.addPeriodicEvent(world.upkeep, 300)
|
||||
world.startedAt = started
|
||||
try:
|
||||
while world.ircs:
|
||||
while world.ircs:
|
||||
try:
|
||||
drivers.run()
|
||||
log.info('No more Irc objects, exiting.')
|
||||
except KeyboardInterrupt:
|
||||
log.info('Exiting due to Ctrl-C.')
|
||||
now = time.time()
|
||||
log.info('Total uptime: %s.', utils.timeElapsed(now - world.startedAt))
|
||||
(user, system, _, _, _) = os.times()
|
||||
log.info('Total CPU time taken: %s seconds.', user+system)
|
||||
raise SystemExit
|
||||
except:
|
||||
log.exception('Exception raised out of drivers.run:')
|
||||
except KeyboardInterrupt:
|
||||
log.info('Exiting due to Ctrl-C.')
|
||||
now = time.time()
|
||||
seconds = now - world.startedAt
|
||||
log.info('Total uptime: %s.', utils.timeElapsed(seconds))
|
||||
(user, system, _, _, _) = os.times()
|
||||
log.info('Total CPU time taken: %s seconds.', user+system)
|
||||
raise SystemExit
|
||||
except:
|
||||
try: # Ok, now we're *REALLY* paranoid!
|
||||
log.exception('Exception raised out of drivers.run:')
|
||||
except Exception, e:
|
||||
print 'Exception raised in log.exception. This is *really*'
|
||||
print 'bad. Hopefully it won\'t happen again, but tell us'
|
||||
print 'about it anyway, this is a significant problem.'
|
||||
print 'Anyway, here\'s the exception: %s'% utils.exnToString(e)
|
||||
except:
|
||||
print 'Man, this really sucks. Not only did log.exception'
|
||||
print 'raise an exception, but freaking-a, it was a string'
|
||||
print 'exception. People who raise string exceptions should'
|
||||
print 'die a slow, painful death.'
|
||||
log.info('No more Irc objects, exiting.')
|
||||
|
||||
if __name__ == '__main__':
|
||||
###
|
||||
|
@ -74,6 +74,10 @@ def loadPluginModule(name, ignoreDeprecation=False):
|
||||
try:
|
||||
index = loweredFiles.index(name.lower()+'.py')
|
||||
name = os.path.splitext(files[index])[0]
|
||||
if name in sys.modules:
|
||||
m = sys.modules[name]
|
||||
if not hasattr(m, 'Class'):
|
||||
raise ImportError, 'Module is not a plugin.'
|
||||
except ValueError: # We'd rather raise the ImportError, so we'll let go...
|
||||
pass
|
||||
moduleInfo = imp.find_module(name, pluginDirs)
|
||||
@ -335,7 +339,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg):
|
||||
if name in str(e):
|
||||
irc.error('No plugin %s exists.' % name)
|
||||
else:
|
||||
irc.error(utils.exnToString(e))
|
||||
irc.error(str(e))
|
||||
return
|
||||
loadPluginClass(irc, module)
|
||||
conf.registerPlugin(name, True)
|
||||
|
Loading…
Reference in New Issue
Block a user