Exception: EPPClient::EPPErrorResponse

Inherits:
StandardError
  • Object
show all
Defined in:
lib/epp-client/exceptions.rb

Overview

This “strange” exception allows having more informative error messages.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ EPPErrorResponse

An exception with an added field so that it can store the xml response that generated it.



8
9
10
11
12
# File 'lib/epp-client/exceptions.rb', line 8

def initialize(attrs = {})
  @response_xml = attrs[:xml]
  @response_code = attrs[:code]
  @message = attrs[:message]
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



4
5
6
# File 'lib/epp-client/exceptions.rb', line 4

def message
  @message
end

#response_codeObject

Returns the value of attribute response_code.



4
5
6
# File 'lib/epp-client/exceptions.rb', line 4

def response_code
  @response_code
end

#response_xmlObject

Returns the value of attribute response_xml.



4
5
6
# File 'lib/epp-client/exceptions.rb', line 4

def response_xml
  @response_xml
end

Instance Method Details

#inspectObject

:nodoc:



18
19
20
# File 'lib/epp-client/exceptions.rb', line 18

def inspect #:nodoc:
  "#<#{self.class}: code: #{@response_code}, message: #{@message.inspect}, xml: #{@response_xml}>"
end

#to_sObject

:nodoc:



14
15
16
# File 'lib/epp-client/exceptions.rb', line 14

def to_s #:nodoc:
  "#{@message} (code #{@response_code})"
end