Sha256: e12586260a6337f9c857f04bc5c31fef81c0ddb53d4204fe6184eb0ff52727ac
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
class OpenpayException < StandardError attr_reader :description attr_reader :http_code attr_reader :http_body attr_reader :json_body attr_reader :error_code attr_reader :category def initialize(message=nil,json_message=true) #openpay errors have a json error string if json_message json= JSON.parse message @description = json['description'] @http_code = json['http_code'] @error_code = json['error_code'] @json_body = message @category = json['category'] #other errors may or not have a json error string, so this case is for them else @description = message @http_code = '' @http_body = '' @json_body = '' @error_code = '' end end =begin rescue RestClient::BadRequest => e oe=OpenpayTransactionException.new(e.message,e.http_code,e.http_body,e.http_body) LOG.warn e.http_body @errors=true raise oe rescue RestClient::BadGateway => e oe=OpenpayConnectionException.new(e.message,e.http_code,e.http_body,e.http_body) LOG.warn e.http_body @errors=true raise oe rescue RestClient::Exception => e oe=OpenpayApiError.new(e.message,e.http_code,e.http_body,e.http_body) LOG.warn e.http_body @errors=true raise oe =end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
openpay-0.9.8 | lib/OpenPay/errors/open_pay_exception.rb |