From 7ada1ede4aec4939d85b2851e6b6e12f940eff8c Mon Sep 17 00:00:00 2001 From: Luke Campagnola <> Date: Thu, 21 Jun 2012 21:24:44 -0400 Subject: [PATCH] reloadAll now raises exception if any modules fail to reload --- reload.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reload.py b/reload.py index 85892c2d..91801fe1 100644 --- a/reload.py +++ b/reload.py @@ -34,6 +34,7 @@ def reloadAll(prefix=None, debug=False): - Skips reload if the file has not been updated (if .pyc is newer than .py) - if prefix is None, checks all loaded modules """ + failed = [] for modName, mod in list(sys.modules.items()): ## don't use iteritems; size may change during reload if not inspect.ismodule(mod): continue @@ -58,7 +59,10 @@ def reloadAll(prefix=None, debug=False): reload(mod, debug=debug) except: printExc("Error while reloading module %s, skipping\n" % mod) - + failed.append(mod.__name__) + + if len(failed) > 0: + raise Exception("Some modules failed to reload: %s" % ', '.join(failed)) def reload(module, debug=False, lists=False, dicts=False): """Replacement for the builtin reload function: