Sha256: 3a1ef3ecf8306caad56f43672ee562357623a5bac4f0b695fc091db4db70681e

Contents?: true

Size: 493 Bytes

Versions: 7

Compression:

Stored size: 493 Bytes

Contents

require 'ditty/services/logger'

module Ditty
  module Middleware
    class ErrorCatchall
      attr_reader :env

      def initialize(app)
        @app = app
      end

      def call(env)
        @env = env
        begin
          @app.call env
        rescue StandardError => e
          ::Ditty::Services::Logger.instance.error "Ditty Catchall: #{e.class}"
          ::Ditty::Services::Logger.instance.error e
          [500, {}, ['Unknown Error']]
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ditty-0.7.2 lib/ditty/middleware/error_catchall.rb
ditty-0.7.1 lib/ditty/middleware/error_catchall.rb
ditty-0.7.0 lib/ditty/middleware/error_catchall.rb
ditty-0.7.0.pre.rc1 lib/ditty/middleware/error_catchall.rb
ditty-0.6.0 lib/ditty/middleware/error_catchall.rb
ditty-0.4.1 lib/ditty/middleware/error_catchall.rb
ditty-0.4.0 lib/ditty/middleware/error_catchall.rb