Exception: Services::SltcApiException

Inherits:
StandardError
  • Object
show all
Defined in:
app/models/services/sltc_api_exception.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exception) ⇒ SltcApiException

Returns a new instance of SltcApiException.



8
9
10
11
12
13
# File 'app/models/services/sltc_api_exception.rb', line 8

def initialize(exception)
  @inner_exception = exception
  @raw_json = exception.response if exception && exception.respond_to?(:response)
  @error_code = -1
  super format_exception_message
end

Instance Attribute Details

#error_codeObject (readonly)

Returns the value of attribute error_code.



6
7
8
# File 'app/models/services/sltc_api_exception.rb', line 6

def error_code
  @error_code
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



6
7
8
# File 'app/models/services/sltc_api_exception.rb', line 6

def error_message
  @error_message
end

#error_responseObject (readonly)

Returns the value of attribute error_response.



6
7
8
# File 'app/models/services/sltc_api_exception.rb', line 6

def error_response
  @error_response
end

#inner_exceptionObject (readonly)

Returns the value of attribute inner_exception.



5
6
7
# File 'app/models/services/sltc_api_exception.rb', line 5

def inner_exception
  @inner_exception
end

#raw_jsonObject (readonly)

Returns the value of attribute raw_json.



6
7
8
# File 'app/models/services/sltc_api_exception.rb', line 6

def raw_json
  @raw_json
end

Instance Method Details

#http_codeObject



15
16
17
# File 'app/models/services/sltc_api_exception.rb', line 15

def http_code
  inner_exception.http_code if inner_exception && inner_exception.respond_to?(:http_code)
end

#http_messageObject



19
20
21
# File 'app/models/services/sltc_api_exception.rb', line 19

def http_message
  inner_exception.message if inner_exception && inner_exception.respond_to?(:message)
end