diff options
author | elijah <elijah@riseup.net> | 2013-01-21 22:50:38 -0800 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2013-01-21 22:50:38 -0800 |
commit | 0621d780676c8f78a7205a4350f9e5d6b6a6ec5e (patch) | |
tree | 49d5dad8fc8af2a22e7a553ca9b8ce1f1c48283c /lib | |
parent | cc7aee74ed731c26d596ce8a8200e46e2fc9110a (diff) | |
download | leap_cli-0621d780676c8f78a7205a4350f9e5d6b6a6ec5e.tar.gz leap_cli-0621d780676c8f78a7205a4350f9e5d6b6a6ec5e.tar.bz2 |
much better error reporting for bad evals in json configs
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/config/object.rb | 12 |
1 files changed, 7 insertions, 5 deletions
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 |