Exception: VCAP::Services::Api::ServiceGatewayClient::ErrorResponse

Inherits:
StandardError
  • Object
show all
Defined in:
lib/services/api/clients/service_gateway_client.rb

Overview

Public: Indicate an error response from gateway

Direct Known Subclasses

GatewayInternalResponse, NotFoundResponse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, error) ⇒ ErrorResponse

status - the http status error - a ServiceErrorResponse object



31
32
33
34
# File 'lib/services/api/clients/service_gateway_client.rb', line 31

def initialize(status, error)
  @status = status
  @error = error
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



26
27
28
# File 'lib/services/api/clients/service_gateway_client.rb', line 26

def error
  @error
end

#statusObject (readonly)

Returns the value of attribute status.



26
27
28
# File 'lib/services/api/clients/service_gateway_client.rb', line 26

def status
  @status
end

Instance Method Details

#to_hObject



40
41
42
43
44
45
46
47
# File 'lib/services/api/clients/service_gateway_client.rb', line 40

def to_h
  {
    'error' => error.extract(stringify_keys: true).merge(
      'backtrace' => backtrace,
      'types' => self.class.ancestors.map(&:name) - Exception.ancestors.map(&:name)
    )
  }
end

#to_sObject



36
37
38
# File 'lib/services/api/clients/service_gateway_client.rb', line 36

def to_s
  "#{self.class.name}: #{error.description}"
end