]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
much better error reporting for bad evals in json configs
authorelijah <elijah@riseup.net>
Tue, 22 Jan 2013 06:50:38 +0000 (22:50 -0800)
committerelijah <elijah@riseup.net>
Tue, 22 Jan 2013 06:50:38 +0000 (22:50 -0800)
lib/leap_cli/config/object.rb

index 5c6cfd0481381b68ad062bb3421040950e69f48f..ef5133f3c3d95895f41a25e02308bba98f555ad2 100644 (file)
@@ -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