Class: Namira::Middleware::Timeout

Inherits:
Object
  • Object
show all
Defined in:
lib/namira/middleware/timeout.rb

Overview

Handles timeout errors

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Timeout

Returns a new instance of Timeout.



6
7
8
# File 'lib/namira/middleware/timeout.rb', line 6

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Called by the middleware runner.

Parameters:



14
15
16
17
18
# File 'lib/namira/middleware/timeout.rb', line 14

def call(env)
  @app.call(env)
rescue HTTP::TimeoutError => e
  raise Errors::TimeoutError.new(e.message)
end