Class: Miteru::HTTP::BetterError

Inherits:
HTTP::Feature
  • Object
show all
Defined in:
lib/miteru/http.rb

Overview

Better error handling feature

Instance Method Summary collapse

Instance Method Details

#wrap_response(response) ⇒ Object

Raises:



11
12
13
14
15
16
17
18
19
# File 'lib/miteru/http.rb', line 11

def wrap_response(response)
  return response if response.status.success?

  raise StatusError.new(
    "Unsuccessful response code returned: #{response.code}",
    response.code,
    response.body.to_s
  )
end