Class: Ditty::Middleware::ErrorCatchall

Inherits:
Object
  • Object
show all
Defined in:
lib/ditty/middleware/error_catchall.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ErrorCatchall

Returns a new instance of ErrorCatchall.



6
7
8
# File 'lib/ditty/middleware/error_catchall.rb', line 6

def initialize(app)
  @app = app
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



4
5
6
# File 'lib/ditty/middleware/error_catchall.rb', line 4

def env
  @env
end

Instance Method Details

#call(env) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/ditty/middleware/error_catchall.rb', line 10

def call(env)
  @env = env
  begin
    @app.call env
  rescue StandardError
    [500, {}, ['Unknown Error']]
  end
end