Exception: Hyperb::Error

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

Overview

representation of Hyper errors

Direct Known Subclasses

UnsupportedRegion

Defined Under Namespace

Classes: UnsupportedRegion

Constant Summary collapse

ClientError =

4xx HTTP status code

Class.new(self)
ServerError =

5xx HTTP status code

Class.new(self)
NotModified =

hyper uses code 304 as a server representation for some operations

Class.new(ClientError)
BadRequest =

code 400

Class.new(ClientError)
Unauthorized =

code 401

Class.new(ClientError)
NotFound =

code 404

Class.new(ClientError)
Conflict =

code 409

Class.new(ClientError)
InternalServerError =

code 500

Class.new(ServerError)
ERRORS =
{
  304 => Hyperb::Error::NotModified,
  400 => Hyperb::Error::BadRequest,
  401 => Hyperb::Error::Unauthorized,
  404 => Hyperb::Error::NotFound,
  409 => Hyperb::Error::Conflict,
  500 => Hyperb::Error::InternalServerError
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(msg, code = nil) ⇒ Error

Returns a new instance of Error.



46
47
48
49
# File 'lib/hyperb/error.rb', line 46

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

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



4
5
6
# File 'lib/hyperb/error.rb', line 4

def code
  @code
end

#msgObject (readonly)

Returns the value of attribute msg.



4
5
6
# File 'lib/hyperb/error.rb', line 4

def msg
  @msg
end