Exception: OCI::Errors::ResponseParsingError
- Inherits:
- 
      HttpRequestBasedError
      
        - Object
- StandardError
- HttpRequestBasedError
- OCI::Errors::ResponseParsingError
 
- Defined in:
- lib/oci/errors.rb
Overview
The base error for issues related to parsing the response received from the service. The #response_body can be inspected for the data which failed to parse and the #cause of this error can be inspected for the underlying parsing error which occurred
Instance Attribute Summary collapse
- 
  
    
      #response_received  ⇒ Net::HTTPResponse 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The response received for the request, and whose body we failed to parse. 
Attributes inherited from HttpRequestBasedError
#message, #request_id, #request_made
Instance Method Summary collapse
- 
  
    
      #initialize(message: 'Failed to parse response', request_made:, response_received:)  ⇒ ResponseParsingError 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of ResponseParsingError. 
- 
  
    
      #response_body  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The response body which we failed to parse. 
- 
  
    
      #status_code  ⇒ Integer 
    
    
  
  
  
  
  
  
  
  
  
    The status code of the response (e.g. 200). 
- #to_s ⇒ Object
Constructor Details
#initialize(message: 'Failed to parse response', request_made:, response_received:) ⇒ ResponseParsingError
Returns a new instance of ResponseParsingError.
| 129 130 131 132 133 134 135 136 137 | # File 'lib/oci/errors.rb', line 129 def initialize(message: 'Failed to parse response', request_made:, response_received:) raise 'A message must be provided' if .nil? || .strip.empty? raise 'The request made must be provided' if request_made.nil? raise 'The response received must be provided' if response_received.nil? super(message: , request_made: request_made) @response_received = response_received @request_id = @response_received['opc-request-id'] unless @response_received['opc-request-id'].nil? end | 
Instance Attribute Details
#response_received ⇒ Net::HTTPResponse (readonly)
The response received for the request, and whose body we failed to parse
| 127 128 129 | # File 'lib/oci/errors.rb', line 127 def response_received @response_received end | 
Instance Method Details
#response_body ⇒ String
The response body which we failed to parse
| 142 143 144 | # File 'lib/oci/errors.rb', line 142 def response_body response_received.body end | 
#status_code ⇒ Integer
The status code of the response (e.g. 200)
| 149 150 151 | # File 'lib/oci/errors.rb', line 149 def status_code response_received.code.to_i end | 
#to_s ⇒ Object
| 153 154 155 156 | # File 'lib/oci/errors.rb', line 153 def to_s "{ 'message': '#{}', 'status': #{status_code}, " \ "'opc-request-id': '#{request_id}', 'response-body': '#{response_body}' }" end |