Skip to content

Commit

Permalink
Catch exception during imports (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dariusz Suchojad committed Jun 25, 2013
1 parent adc9687 commit 6c85bd9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions code/zato-server/src/zato/server/service/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ def import_services_from_file(self, file_name, is_internal, base_dir):
if os.path.exists(path):
os.remove(path)

mod = imp.load_source(mod_name, file_name)
self._visit_module(mod, is_internal, file_name)
try:
mod = imp.load_source(mod_name, file_name)
except Exception, e:
msg = 'Could not load source mod_name:[{}] file_name:[{}], e:[{}]'.format(
mod_name, file_name, format_exc(e))
logger.error(msg)
else:
self._visit_module(mod, is_internal, file_name)

def import_services_from_directory(self, dir_name, base_dir, dist2):
""" dir_name points to a directory.
Expand Down

0 comments on commit 6c85bd9

Please sign in to comment.