From b07bfb6e23f587824f8cdcd1d8fdbbecb395ee2b Mon Sep 17 00:00:00 2001 From: Satoru SATOH Date: Tue, 2 Jun 2015 13:09:17 +0900 Subject: [PATCH] catch exception and print it during load just in case --- anyconfig/api.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/anyconfig/api.py b/anyconfig/api.py index 3bb28e48..4bc0b7d3 100644 --- a/anyconfig/api.py +++ b/anyconfig/api.py @@ -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) @@ -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] + '...')