Browse files

Fail less hard if an installed extension is missing

For inject roles, extension errors should be handled by inserting an
HTML comment with an error message into the target page, rather than
by failing completely to load the target page.  This was done for most
types of extension errors, but not if the extension's manifest failed
to load, for instance because the extension had been removed.
  • Loading branch information...
1 parent a2530c7 commit 7c12a6990a0cd0258694b983ef3da0d68e03af05 @jensl committed Nov 26, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 extensions.py
View
5 extensions.py
@@ -955,7 +955,10 @@ def param(raw):
if sha1 is None: extension_path = os.path.join(configuration.extensions.SEARCH_ROOT, author.name, "CriticExtensions", extension_name)
else: extension_path = os.path.join(configuration.extensions.INSTALL_DIR, sha1)
- manifest = loadManifest(extension_path)
+ try: manifest = loadManifest(extension_path)
+ except Exception, error:
+ document.comment("\n\nExtension error:\n%s\n\n" % str(error))
+ continue
for role in manifest.roles:
if isinstance(role, InjectRole) and role.regexp == regexp and role.script == script and role.function == function:

0 comments on commit 7c12a69

Please sign in to comment.