From 578541a02b85d622f06637b29e2a6f8e32515994 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 29 Jul 2013 13:39:15 -0700 Subject: added assert() macro. if failed, spits out this on compile: = FAILED assertion while evaluating node 'worm' - assertion: services.include? 'couchdb' - offending key: require_couchdb = bailing out --- lib/leap_cli/config/object.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/leap_cli/config/object.rb') diff --git a/lib/leap_cli/config/object.rb b/lib/leap_cli/config/object.rb index 00997b1..1d296b3 100644 --- a/lib/leap_cli/config/object.rb +++ b/lib/leap_cli/config/object.rb @@ -282,6 +282,12 @@ module LeapCli Util::log "error message: no file '#{exc}'", :indent => 1 end end + rescue AssertionFailed => exc + Util.bail! do + Util::log :failed, "assertion while evaluating node '#{@node.name}'" + Util::log 'assertion: %s' % exc.assertion, :indent => 1 + Util::log "offending key: #{key}", :indent => 1 + end rescue SyntaxError, StandardError => exc Util::bail! do Util::log :error, "while evaluating node '#{@node.name}'" -- cgit v1.2.3