[enh] Display hook path on error message.

This commit is contained in:
opi 2016-03-27 11:25:33 +02:00
parent f176c3061e
commit 7999293438
2 changed files with 5 additions and 5 deletions

View file

@ -94,8 +94,8 @@
"hook_list_by_invalid" : "Invalid property to list hook by",
"hook_name_unknown" : "Unknown hook name '{:s}'",
"hook_exec_failed" : "Script execution failed",
"hook_exec_not_terminated" : "Script execution hasnt terminated",
"hook_exec_failed" : "Script execution failed: {path:s}",
"hook_exec_not_terminated" : "Script execution hasnt terminated: {path:s}",
"mountpoint_unknown" : "Unknown mountpoint",
"unit_unknown" : "Unknown unit '{:s}'",

View file

@ -330,12 +330,12 @@ def hook_exec(path, args=None, raise_on_error=False, no_trace=False):
# Check and return process' return code
if returncode is None:
if raise_on_error:
raise MoulinetteError(m18n.n('hook_exec_not_terminated'))
raise MoulinetteError(m18n.n('hook_exec_not_terminated', path=path))
else:
logger.error(m18n.n('hook_exec_not_terminated'))
logger.error(m18n.n('hook_exec_not_terminated', path=path))
return 1
elif raise_on_error and returncode != 0:
raise MoulinetteError(m18n.n('hook_exec_failed'))
raise MoulinetteError(m18n.n('hook_exec_failed', path=path))
return returncode