Exception: Shippo::Exceptions::Error

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(thing = nil) ⇒ Error

Returns a new instance of Error.



7
8
9
10
11
12
13
14
15
# File 'lib/shippo/exceptions/error.rb', line 7

def initialize(thing = nil)
  if thing.is_a?(String)
    self.message = thing
  elsif thing.respond_to?(:message)
    self.message = thing.message
  else
    super(thing)
  end
end

Instance Attribute Details

#messageObject

Returns the value of attribute message.



5
6
7
# File 'lib/shippo/exceptions/error.rb', line 5

def message
  @message
end

Instance Method Details

#to_sObject



21
22
23
24
25
26
27
28
# File 'lib/shippo/exceptions/error.rb', line 21

def to_s
  out = super
  out << " (#{message}) " if message
  to_s_members.each do |member|
    out << member_to_s(member)
  end
  out
end

#to_s_membersObject



17
18
19
# File 'lib/shippo/exceptions/error.rb', line 17

def to_s_members
  %i()
end