Improve CLI error reporting

This commit is contained in:
Thibault Jouan
2014-10-11 17:34:19 +00:00
parent f6237bfc0c
commit 25d03d4322
8 changed files with 142 additions and 7 deletions

View File

@@ -5,7 +5,14 @@ module Producer
class << self
def evaluate(file_path, env)
content = File.read(file_path)
Recipe.new(env).tap { |o| o.instance_eval content, file_path }
begin
Recipe.new(env).tap { |o| o.instance_eval content, file_path }
rescue Exception => e
fail RecipeEvaluationError, e.message, [
'%s (recipe)' % file_path,
*e.backtrace
]
end
end
end
end