Class: Hugs::Errors::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/hugs/errors.rb

Overview

504

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ HTTP

Returns a new instance of HTTP.



43
44
45
46
47
# File 'lib/hugs/errors.rb', line 43

def initialize options
  @raise_errors = options[:raise_errors]

  initialize_errors
end

Instance Method Details

#on(response) ⇒ Object



49
50
51
52
53
54
55
# File 'lib/hugs/errors.rb', line 49

def on response
  case response.code
    when @raise_errors && %r{^[45]{1}[0-9]{2}$} ; raise_for(response)
  end

  response
end