Permalink
Browse files

Merge pull request #72 from ngokevin/master

issue with catching all import errors within hooks
  • Loading branch information...
2 parents 8d3dff1 + b7a1546 commit 067f8d6017afa01b831a2465852c33ba28bd03f9 @mythmon committed Mar 13, 2012
Showing with 8 additions and 3 deletions.
  1. +8 −3 wok/engine.py
View
@@ -111,7 +111,7 @@ def __init__(self, output_lvl=1):
self.options['media_dir'],
self.options['template_dir'],
self.options['content_dir']
- ],
+ ],
change_handler=self.generate_site)
server.run()
@@ -179,8 +179,13 @@ def load_hooks(self):
import __hooks__
self.hooks = __hooks__.hooks
logging.info('Loaded {0} hooks: {0}'.format(self.hooks))
- except ImportError:
- logging.info('No hooks module found.')
+ except ImportError as e:
+ if "__hooks__" in str(e):
+ logging.info('No hooks module found.')
+ else:
+ # don't catch import errors raised within a hook
+ logging.info('Import error within hooks.')
+ raise ImportError(e)
def run_hook(self, hook_name, *args):
""" Run specified hooks if they exist """

0 comments on commit 067f8d6

Please sign in to comment.