-
Notifications
You must be signed in to change notification settings - Fork 4
Error handling
ofetisov edited this page Sep 27, 2016
·
6 revisions
When making a payment, there are two different scenarios that can arise.
- ValidationError can happen when you haven’t filled in all required fields in the model.
- ApiException can happen if your request is sent to the partner’s API and returns unsuccessful response. See API error messages.
It is important to handle all of the different exceptions in your code.
begin
# Your payment code
rescue Judopay::ValidationError
# There were missing or invalid fields
puts $!
rescue Judopay::APIError
# Judo API exception
puts $!
rescue
# A problem occurred outside the Judopay SDK
puts $!
end