Sha256: 8cac9cff1b5735aca3f1d2c60823b5c680aaeeaac5c1e4b707add5143a35f36b

Contents?: true

Size: 527 Bytes

Versions: 5

Compression:

Stored size: 527 Bytes

Contents

module DebugExtras
  class Debug
    def initialize(app)
      @app = app
    end

    def call(env)
      @app.call env
    rescue StandardError => ex
      process_exception(ex, env)
    end

    private

    def process_exception(ex, env)
      if [ex.class, ex.cause.class].map(&:to_s).include? "DebugExtras::DebugData"
        debug_page = DebugPage.new(ex, env["PATH_INFO"])
        [200, { "Content-Type" => "text/html; charset=utf-8" }, [debug_page.render]]
      else
        @app.call env
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
debug-extras-0.3.6 lib/debug_extras/middleware/debug.rb
debug-extras-0.3.5 lib/debug_extras/middleware/debug.rb
debug-extras-0.3.4 lib/debug_extras/middleware/debug.rb
debug-extras-0.3.3 lib/debug_extras/middleware/debug.rb
debug-extras-0.3.2 lib/debug_extras/middleware/debug.rb