Class: Upfluence::HTTP::Middleware::HandleException
- Inherits:
-
Object
- Object
- Upfluence::HTTP::Middleware::HandleException
- Defined in:
- lib/upfluence/http/middleware/handle_exception.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ HandleException
constructor
A new instance of HandleException.
Constructor Details
#initialize(app) ⇒ HandleException
Returns a new instance of HandleException.
5 6 7 |
# File 'lib/upfluence/http/middleware/handle_exception.rb', line 5 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 |
# File 'lib/upfluence/http/middleware/handle_exception.rb', line 9 def call(env) @app.call(env) rescue StandardError, LoadError, SyntaxError => e [500, {}, ["{\"error\": \"#{e.class.name}\"}"]] end |