From: elijah Date: Tue, 22 Jan 2013 06:50:38 +0000 (-0800) Subject: much better error reporting for bad evals in json configs X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=0621d780676c8f78a7205a4350f9e5d6b6a6ec5e;p=leap%2Fleap_cli.git much better error reporting for bad evals in json configs --- diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb index 5c6cfd0..ef5133f 100644 --- a/lib/leap_cli/config/object.rb +++ b/lib/leap_cli/config/object.rb @@ -382,7 +382,8 @@ module LeapCli return @node.instance_eval(value) rescue SystemStackError => exc Util::log 0, :error, "while evaluating node '#{@node.name}'" - Util::log 0, "offending string: #{$1}", :indent => 1 + Util::log 0, "offending key: #{key}", :indent => 1 + Util::log 0, "offending string: #{value}", :indent => 1 Util::log 0, "STACK OVERFLOW, BAILING OUT. There must be an eval loop of death (variables with circular dependencies).", :indent => 1 raise SystemExit.new() rescue FileMissing => exc @@ -391,16 +392,17 @@ module LeapCli Util::log :missing, exc.options[:missing].gsub('$node', @node.name) else Util::log :error, "while evaluating node '#{@node.name}'" - Util::log "offending string: #{$1}", :indent => 1 + Util::log "offending key: #{key}", :indent => 1 + Util::log "offending string: #{value}", :indent => 1 Util::log "error message: no file '#{exc}'", :indent => 1 end end rescue SyntaxError, StandardError => exc Util::bail! do - Util::log exc.inspect Util::log :error, "while evaluating node '#{@node.name}'" - Util::log "offending string: #{$1}", :indent => 1 - Util::log "error message: #{exc}", :indent => 1 + Util::log "offending key: #{key}", :indent => 1 + Util::log "offending string: #{value}", :indent => 1 + Util::log "error message: #{exc.inspect}", :indent => 1 end end