]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
better error messages when json or node parsing goes wrong.
authorelijah <elijah@riseup.net>
Sun, 31 Mar 2013 21:14:37 +0000 (14:14 -0700)
committerelijah <elijah@riseup.net>
Sun, 31 Mar 2013 21:14:37 +0000 (14:14 -0700)
lib/leap_cli/config/manager.rb
lib/leap_cli/util.rb

index cf4d127fa59e1f70e2e87dc61c98fd74bc43f7b6..f5282c56036f6455d3861513512518bbf7abb4cc 100644 (file)
@@ -199,7 +199,7 @@ module LeapCli
         # parse json
         begin
           hash = JSON.parse(buffer.string, :object_class => Hash, :array_class => Array) || {}
-        rescue SyntaxError => exc
+        rescue SyntaxError, JSON::ParserError => exc
           log 0, :error, 'in file "%s":' % filename
           log 0, exc.to_s, :indent => 1
           return nil
index 0453b6d43f8f220352e268384dd155132986b309..b2a1dcf5bd5b63023a669a35711886ea99201a28 100644 (file)
@@ -111,13 +111,14 @@ module LeapCli
 
     def assert_config!(conf_path)
       value = nil
-      #begin
+      begin
         value = manager.instance_eval(conf_path)
       #rescue NoMethodError
       #rescue NameError
-      #end
-      assert! !value.nil? && value != "REQUIRED" do
-        log :missing, "required configuration value for #{conf_path}"
+      ensure
+        assert! !value.nil? && value != "REQUIRED" do
+          log :missing, "required configuration value for #{conf_path}"
+        end
       end
     end