Sha256: 5b4abdb319b9ad6ae3b5b3fb1804a785d9068aab4a20323812fe6609a6f55c48

Contents?: true

Size: 379 Bytes

Versions: 15

Compression:

Stored size: 379 Bytes

Contents

class SiteHub
  module Middleware
    class ErrorHandling
      ERROR_RESPONSE = Rack::Response.new(['error'], 500, {})

      attr_reader :app

      def initialize(app)
        @app = app
      end

      def call(env)
        @app.call env
      rescue StandardError => exception
        env[ERRORS] << exception.message
        ERROR_RESPONSE.dup
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
sitehub-0.5.0.alpha12 lib/sitehub/middleware/error_handling.rb
sitehub-0.4.10 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha11 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha10 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha8 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha7 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha6 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha5 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha4 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha3 lib/sitehub/middleware/error_handling.rb
sitehub-0.5.0.alpha2 lib/sitehub/middleware/error_handling.rb
sitehub-0.4.9 lib/sitehub/middleware/error_handling.rb
sitehub-0.4.8 lib/sitehub/middleware/error_handling.rb
sitehub-0.4.7 lib/sitehub/middleware/error_handling.rb
sitehub-0.4.6 lib/sitehub/middleware/error_handling.rb