Exception: OCI::Errors::ServiceError
- Inherits:
 - 
      HttpRequestBasedError
      
        
- Object
 - StandardError
 - HttpRequestBasedError
 - OCI::Errors::ServiceError
 
 
- Defined in:
 - lib/oci/errors.rb
 
Overview
The base error for all requests that return error responses from the service.
Instance Attribute Summary collapse
- 
  
    
      #service_code  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
A service-specific error code.
 - 
  
    
      #status_code  ⇒ Integer 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
HTTP status code (such as 200 or 404).
 
Attributes inherited from HttpRequestBasedError
#message, #request_id, #request_made
Instance Method Summary collapse
- 
  
    
      #initialize(status_code, service_code, request_id, message, request_made: nil)  ⇒ ServiceError 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of ServiceError.
 - #to_s ⇒ Object
 
Constructor Details
#initialize(status_code, service_code, request_id, message, request_made: nil) ⇒ ServiceError
Returns a new instance of ServiceError.
      61 62 63 64 65 66 67 68 69 70 71 72  | 
    
      # File 'lib/oci/errors.rb', line 61 def initialize(status_code, service_code, request_id, , request_made: nil) @message = if .nil? || .strip.empty? "The service returned error code #{status_code}" else .strip end super(message: @message, request_made: request_made) @status_code = status_code @service_code = service_code @request_id = request_id end  | 
  
Instance Attribute Details
#service_code ⇒ String (readonly)
A service-specific error code
      59 60 61  | 
    
      # File 'lib/oci/errors.rb', line 59 def service_code @service_code end  | 
  
#status_code ⇒ Integer (readonly)
HTTP status code (such as 200 or 404)
      54 55 56  | 
    
      # File 'lib/oci/errors.rb', line 54 def status_code @status_code end  | 
  
Instance Method Details
#to_s ⇒ Object
      74 75 76 77  | 
    
      # File 'lib/oci/errors.rb', line 74 def to_s "{ 'message': '#{}', 'status': #{status_code}, " \ "'code': '#{service_code}', 'opc-request-id': '#{request_id}' }" end  |