Class: HttpEventStore::Api::ErrorsHandler

Inherits:
Faraday::Response::Middleware
  • Object
show all
Defined in:
lib/http_event_store/api/errors_handler.rb

Instance Method Summary collapse

Instance Method Details

#on_complete(env) ⇒ Object


8
9
10
11
12
13
14
15
16
# File 'lib/http_event_store/api/errors_handler.rb', line 8

def on_complete(env)
  code = env[:status]
  case code
    when (400..499)
      raise ClientError.new(code)
    when (500..599)
      raise ServerError.new(code)
  end
end