Exception: ShipEngine::Exceptions::ShipEngineError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/shipengine/exceptions.rb

Overview

400 error, or other “user exceptions”

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message:, source:, type:, code:, request_id:, url: nil) ⇒ ShipEngineError

rubocop:todo Metrics/ParameterLists



14
15
16
17
18
19
20
21
22
# File 'lib/shipengine/exceptions.rb', line 14

def initialize(message:, source:, type:, code:, request_id:, url: nil) # rubocop:todo Metrics/ParameterLists
  code = Exceptions::ErrorCode.get_by_str(code) if code.is_a?(String)
  super(message)
  @request_id = request_id
  @source = source || DEFAULT_SOURCE
  @type = type
  @code = code
  @url = url
end

Instance Attribute Details

#codeObject (readonly)

message is inherited



12
13
14
# File 'lib/shipengine/exceptions.rb', line 12

def code
  @code
end

#request_idObject (readonly)

message is inherited



12
13
14
# File 'lib/shipengine/exceptions.rb', line 12

def request_id
  @request_id
end

#sourceObject (readonly)

message is inherited



12
13
14
# File 'lib/shipengine/exceptions.rb', line 12

def source
  @source
end

#typeObject (readonly)

message is inherited



12
13
14
# File 'lib/shipengine/exceptions.rb', line 12

def type
  @type
end

#urlObject (readonly)

message is inherited



12
13
14
# File 'lib/shipengine/exceptions.rb', line 12

def url
  @url
end