Sha256: d4efbcfa41b260c552a3a7a962b371d272ebc26ae08e7bd504a8fe3299708633

Contents?: true

Size: 438 Bytes

Versions: 5

Compression:

Stored size: 438 Bytes

Contents

module Pliny::Middleware
  class RescueErrors
    def initialize(app, options = {})
      @app = app
      @raise = options[:raise]
    end

    def call(env)
      @app.call(env)
    rescue Pliny::Errors::Error => e
      Pliny::Errors::Error.render(e)
    rescue => e
      raise if @raise

      Pliny::ErrorReporters.notify(e, rack_env: env)
      Pliny::Errors::Error.render(Pliny::Errors::InternalServerError.new)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pliny-0.20.2 lib/pliny/middleware/rescue_errors.rb
pliny-0.20.1 lib/pliny/middleware/rescue_errors.rb
pliny-0.20.0 lib/pliny/middleware/rescue_errors.rb
pliny-0.19.0 lib/pliny/middleware/rescue_errors.rb
pliny-0.18.0 lib/pliny/middleware/rescue_errors.rb