Exception: EasyPost::Errors::ExternalApiError

Inherits:
EasyPostError
  • Object
show all
Defined in:
lib/easypost/errors/api/external_api_error.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, status_code = nil) ⇒ ExternalApiError

Returns a new instance of ExternalApiError.



6
7
8
9
# File 'lib/easypost/errors/api/external_api_error.rb', line 6

def initialize(message, status_code = nil)
  super message
  @status_code = status_code
end

Instance Attribute Details

#status_codeObject (readonly)

Returns the value of attribute status_code.



4
5
6
# File 'lib/easypost/errors/api/external_api_error.rb', line 4

def status_code
  @status_code
end

Instance Method Details

#pretty_printObject



11
12
13
14
15
16
17
# File 'lib/easypost/errors/api/external_api_error.rb', line 11

def pretty_print
  if status_code.nil?
    return message
  end

  "(#{status_code}): #{message}"
end