Exception: RRD::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rrd-track/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, description) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
# File 'lib/rrd-track/errors.rb', line 5

def initialize(code, description)
  super(description)
  @code = code
  @description = description
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/rrd-track/errors.rb', line 3

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/rrd-track/errors.rb', line 3

def description
  @description
end

Class Method Details

.for_code(code) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rrd-track/errors.rb', line 12

def for_code(code)
  case code
  when '100'; UsernameNotFoundError
  when '110'; PasswordNotFoundError
  when '120'; TrackingNumberNotFoundError
  when '130'; AuthenticationError
  when '200'; ShippingSiteError
  when '300'; DatabaseError
  when '400'; BadTrackingNumberError
  else      ; Error
  end
end