From d74d95d0cd9f8c053e14df670860f7bcf3e29b5b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Thu, 2 Sep 2010 11:56:04 -0700 Subject: [PATCH] Get rid of exceptions/ folder. --- lib/vagrant/action.rb | 2 +- lib/vagrant/exceptions/uncallable_action.rb | 17 ----------------- test/vagrant/action_test.rb | 4 ++-- 3 files changed, 3 insertions(+), 20 deletions(-) delete mode 100644 lib/vagrant/exceptions/uncallable_action.rb diff --git a/lib/vagrant/action.rb b/lib/vagrant/action.rb index 7742d44e0..98c390ae2 100644 --- a/lib/vagrant/action.rb +++ b/lib/vagrant/action.rb @@ -46,7 +46,7 @@ module Vagrant def run(callable, options=nil) callable = Builder.new.use(callable) if callable.kind_of?(Class) callable = self.class.actions[callable] if callable.kind_of?(Symbol) - raise Exceptions::UncallableAction.new(callable) if !callable + raise ArgumentError.new("Argument to run must be a callable object or registered action.") if !callable action_environment = Action::Environment.new(env) action_environment.merge!(options || {}) diff --git a/lib/vagrant/exceptions/uncallable_action.rb b/lib/vagrant/exceptions/uncallable_action.rb deleted file mode 100644 index b971b5ef0..000000000 --- a/lib/vagrant/exceptions/uncallable_action.rb +++ /dev/null @@ -1,17 +0,0 @@ -module Vagrant - module Exceptions - # Raised when an action sequence is trying to be run for an uncallable - # action (not a lambda, middleware, or registered sequence). - class UncallableAction < ::Exception - def initialize(callable) - super() - - @callable = callable - end - - def to_s - @callable.inspect - end - end - end -end diff --git a/test/vagrant/action_test.rb b/test/vagrant/action_test.rb index fe0de9c28..ef35f7175 100644 --- a/test/vagrant/action_test.rb +++ b/test/vagrant/action_test.rb @@ -32,8 +32,8 @@ class ActionTest < Test::Unit::TestCase end should "raise an exception if a nil action is given" do - assert_raises(Vagrant::Exceptions::UncallableAction) { @instance.run(nil) } - assert_raises(Vagrant::Exceptions::UncallableAction) { @instance.run(:dontexist) } + assert_raises(ArgumentError) { @instance.run(nil) } + assert_raises(ArgumentError) { @instance.run(:dontexist) } end should "run the callable item with the proper context" do