Skip to content

Commit

Permalink
catch exception and print it during load just in case
Browse files Browse the repository at this point in the history
  • Loading branch information
ssato committed Jun 2, 2015
1 parent 3a434c2 commit b07bfb6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions anyconfig/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ def single_load(config_path, forced_type=None, ignore_missing=False,
config_content = anyconfig.template.render(config_path, ac_context)
return cparser.loads(config_content, ignore_missing=ignore_missing,
**kwargs)
except:
except Exception as exc:
LOGGER.debug("Exc=%s", str(exc))
LOGGER.warn("Failed to compile %s, fallback to no template "
"mode", config_path)

Expand Down Expand Up @@ -212,7 +213,8 @@ def loads(config_content, forced_type=None, ac_template=False, ac_context=None,
LOGGER.debug("Compiling")
config_content = anyconfig.template.render_s(config_content,
ac_context)
except:
except Exception as exc:
LOGGER.debug("Exc=%s", str(exc))
LOGGER.warn("Failed to compile and fallback to no template "
"mode: '%s'", config_content[:50] + '...')

Expand Down

0 comments on commit b07bfb6

Please sign in to comment.