lib/creditsafe/client.rb in creditsafe-0.1.1 vs lib/creditsafe/client.rb in creditsafe-0.2.0

- old
+ new

@@ -121,11 +121,11 @@ for_code(message.attributes['Code'].value) api_error_message = api_message.message api_error_message += " (#{message.text})" unless message.text.blank? - raise ApiError, api_error_message if api_message.error? + raise api_message.error_class, api_error_message if api_message.error? end end # Takes a proc and rescues any SOAP faults, HTTP errors or Creditsafe errors # There's a potential bug in the creditsafe API where they actually return @@ -139,15 +139,15 @@ end def handle_error(error) raise error rescue Savon::SOAPFault => error - raise ApiError, error.message + raise UnknownApiError, error.message rescue Savon::HTTPError => error if error.to_hash[:code] == 401 - raise ApiError, 'Unauthorized: invalid credentials' + raise AccountError, 'Unauthorized: invalid credentials' end - raise ApiError, error.message + raise UnknownApiError, error.message rescue Excon::Errors::Error => err raise HttpError, "Error making HTTP request: #{err.message}" end def client