Get rid of exceptions/ folder.

This commit is contained in:
Mitchell Hashimoto 2010-09-02 11:56:04 -07:00
parent 9002b22fac
commit d74d95d0cd
3 changed files with 3 additions and 20 deletions

View File

@ -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 || {})

View File

@ -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

View File

@ -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