more helpful error reporting
This commit is contained in:
parent
d40094e2bd
commit
8fdc1e13f3
|
@ -46,8 +46,11 @@ def is_executable(path):
|
|||
return os.path.isfile(path) and os.access(path, os.X_OK)
|
||||
|
||||
def render_moustache(text, config):
|
||||
r = pystache.Renderer(missing_tags = 'strict')
|
||||
return r.render(text, config)
|
||||
try:
|
||||
r = pystache.Renderer(missing_tags = 'strict')
|
||||
return r.render(text, config)
|
||||
except KeyNotFoundError as e:
|
||||
raise CornfigException("key '%s' does not exist metadata file." % e.key)
|
||||
|
||||
def render_executable(path, config):
|
||||
p = Popen([path], stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||
|
|
|
@ -57,7 +57,7 @@ def test_render_template():
|
|||
def test_render_moustache():
|
||||
assert_equals( render_moustache("ab{{x.a}}cd", {"x": {"a": "123"}}), "ab123cd" )
|
||||
|
||||
@raises(KeyNotFoundError)
|
||||
@raises(CornfigException)
|
||||
def test_render_moustache_bad_key():
|
||||
render_moustache("{{badkey}}", {})
|
||||
|
||||
|
|
Loading…
Reference in New Issue