Exception: Typecast::ApiError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/typecast/errors.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status_code, detail = nil) ⇒ ApiError

Returns a new instance of ApiError.



5
6
7
8
9
# File 'lib/typecast/errors.rb', line 5

def initialize(message, status_code, detail = nil)
  super(detail.nil? || detail.empty? ? message : "#{message}: #{detail}")
  @status_code = status_code
  @detail = detail
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail.



3
4
5
# File 'lib/typecast/errors.rb', line 3

def detail
  @detail
end

#status_codeObject (readonly)

Returns the value of attribute status_code.



3
4
5
# File 'lib/typecast/errors.rb', line 3

def status_code
  @status_code
end