Exception: Hackeroo::Error::ServerError

Inherits:
Hackeroo::Error show all
Defined in:
lib/hackeroo/error/server_error.rb

Overview

Raised when Hackeroo returns a 5xx HTTP status code

Constant Summary collapse

MESSAGE =
"Server Error"

Constants inherited from Hackeroo::Error

EnhanceYourCalm, RateLimited

Instance Attribute Summary

Attributes inherited from Hackeroo::Error

#rate_limit, #wrapped_exception

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Hackeroo::Error

#backtrace, descendants, errors

Constructor Details

#initialize(message = nil, response_headers = {}) ⇒ Hackeroo::Error::ServerError

Initializes a new ServerError object

Parameters:

  • message (String) (defaults to: nil)
  • response_headers (Hash) (defaults to: {})


22
23
24
# File 'lib/hackeroo/error/server_error.rb', line 22

def initialize(message=nil, response_headers={})
  super((message || self.class.const_get(:MESSAGE)), response_headers)
end

Class Method Details

.from_response(response = {}) ⇒ Hackeroo::Error

Create a new error from an HTTP environment

Parameters:

  • response (Hash) (defaults to: {})

Returns:



13
14
15
# File 'lib/hackeroo/error/server_error.rb', line 13

def self.from_response(response={})
  new(nil, response[:response_headers])
end