Skip to content

Commit

Permalink
raise UnknownOperationError #385
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiii committed Feb 3, 2013
1 parent 03cc202 commit d813e45
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
Unknown global option: :wsdk
```

* Improvement: [#385](https://github.com/savonrb/savon/issues/385) Instead of raising an
`ArgumentError` when Wasabi can't find any operations in the WSDL. Savon now raises a
`Savon::UnknownOperationError`. This might happen when Wasabi fails to parse the WSDL
because of imports for example.

### 2.1.0 (2013-02-03)

* Feature: [#372](https://github.com/savonrb/savon/pull/372) added global `ssl_cert_key_password` option.
Expand Down
9 changes: 5 additions & 4 deletions lib/savon.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module Savon

Error = Class.new(RuntimeError)
InitializationError = Class.new(Error)
UnknownOptionError = Class.new(Error)
InvalidResponseError = Class.new(Error)
Error = Class.new(RuntimeError)
InitializationError = Class.new(Error)
UnknownOptionError = Class.new(Error)
UnknownOperationError = Class.new(Error)
InvalidResponseError = Class.new(Error)

def self.client(globals = {}, &block)
Client.new(globals, &block)
Expand Down
4 changes: 2 additions & 2 deletions lib/savon/operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ def self.create(operation_name, wsdl, globals)

def self.ensure_exists!(operation_name, wsdl)
unless wsdl.soap_actions.include? operation_name
raise ArgumentError, "Unable to find SOAP operation: #{operation_name.inspect}\n" \
"Operations provided by your service: #{wsdl.soap_actions.inspect}"
raise UnknownOperationError, "Unable to find SOAP operation: #{operation_name.inspect}\n" \
"Operations provided by your service: #{wsdl.soap_actions.inspect}"
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/savon/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@

it "raises if there's no such SOAP operation" do
expect { new_client.operation(:does_not_exist) }.
to raise_error(ArgumentError)
to raise_error(Savon::UnknownOperationError)
end

it "does not raise when there is no WSDL document" do
Expand Down
2 changes: 1 addition & 1 deletion spec/savon/operation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def new_operation(operation_name, wsdl, globals)

it "raises if the operation is not available for the service" do
expect { new_operation(:no_such_operation, wsdl, globals) }.
to raise_error(ArgumentError, /Unable to find SOAP operation: :no_such_operation/)
to raise_error(Savon::UnknownOperationError, /Unable to find SOAP operation: :no_such_operation/)
end
end

Expand Down

0 comments on commit d813e45

Please sign in to comment.