Class: Ditty::Middleware::ErrorCatchall
- Inherits:
-
Object
- Object
- Ditty::Middleware::ErrorCatchall
- Defined in:
- lib/ditty/middleware/error_catchall.rb
Instance Attribute Summary collapse
-
#env ⇒ Object
readonly
Returns the value of attribute env.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ ErrorCatchall
constructor
A new instance of ErrorCatchall.
Constructor Details
#initialize(app) ⇒ ErrorCatchall
Returns a new instance of ErrorCatchall.
10 11 12 |
# File 'lib/ditty/middleware/error_catchall.rb', line 10 def initialize(app) @app = app end |
Instance Attribute Details
#env ⇒ Object (readonly)
Returns the value of attribute env.
8 9 10 |
# File 'lib/ditty/middleware/error_catchall.rb', line 8 def env @env end |
Instance Method Details
#call(env) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ditty/middleware/error_catchall.rb', line 14 def call(env) @env = env begin @app.call env rescue StandardError => e ::Ditty::Services::Logger.error "Ditty Catchall: #{e.class}" ::Ditty::Services::Logger.error e [500, {}, ['Unknown Error']] end end |