Exception: HyperTrack::Error

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code = nil) ⇒ Error

Returns a new instance of Error.



24
25
26
27
# File 'lib/hypertrack/errors/hypertrack_errors.rb', line 24

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/hypertrack/errors/hypertrack_errors.rb', line 4

def code
  @code
end

Class Method Details

.defined_codesObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hypertrack/errors/hypertrack_errors.rb', line 6

def self.defined_codes
  {
    400 => HyperTrack::InvalidParameters,
    401 => HyperTrack::InvalidAPIKey,
    402 => HyperTrack::NoFreeCreditsLeft,
    403 => HyperTrack::AccessForbidden,
    404 => HyperTrack::ResourceNotFound,
    405 => HyperTrack::MethodNotAllowed,
    406 => HyperTrack::FormatNotAcceptable,
    410 => HyperTrack::ResourceRemovedFromServer,
    429 => HyperTrack::RateLimitExceeded,
    500 => HyperTrack::InternalServerError,
    502 => HyperTrack::BadGateway,
    503 => HyperTrack::ServiceTemporarilyUnavailable,
    504 => HyperTrack::GatewayTimeout
  }
end