问题
I'm using eurovat
gem to check a VAT number.
Eurovat.check_vat_number vat_number
If I run that from irb, sometimes I receive this:
SOAP::FaultError: MS_UNAVAILABLE
from
(Nothing appear after "from")
I want to write a begin rescue
block to rescue those error, but how I do know what to rescue?
I have tried with rescue SOAP::FaultError
but didn't works
回答1:
I found the way after a bit of testing:
rescue SOAP::FaultError => e
if e.message == "MS_UNAVAILABLE"
# @ToDO handle service unavailable exception
end
end
回答2:
Ran into a similar issue. This might be of use to you:
MS_UNAVAILABLE means that: "The Member State service is unavailable, try again later or with another Member State".
来源:https://stackoverflow.com/questions/29856485/ruby-how-to-know-what-to-rescue