Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How To: Access SoapErrors #27

Open
TheDevster opened this issue Mar 22, 2018 · 1 comment
Open

How To: Access SoapErrors #27

TheDevster opened this issue Mar 22, 2018 · 1 comment

Comments

@TheDevster
Copy link

How do I get access to the soap errors?

@skplunkerin
Copy link

What method are you calling? Some don't return SOAP errors by default, see my example below about that with the 2 different update calls.

Else, make sure you're wrapping the client call with a begin/rescue (like below).

client.update only returns false when it errors out:

object_name = 'Account'
updates = {Id: '006A000000Lbiiz', Name: 'Whizbang Corp'}
client.update(object_name, updates)

client.update! (with the bang !) returns SOAP errors:

object_name = 'Account'
updates = {Id: '006A000000Lbiiz', Name: 'Whizbang Corp'}
begin
  client.update!(object_name, updates)
rescue Savon::SOAPFault => e
# or to rescue all:
# rescue StandardError => e
  p '=== SOAP FAULT ==='
  error = e.to_hash
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants