locomotivecms/engine

View on GitHub
lib/locomotive/middlewares/custom_public_exceptions.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Locomotive
  module Middlewares

    class CustomPublicExceptions < ActionDispatch::PublicExceptions

      def call(env)
        status = env['PATH_INFO'][1..-1]

        if status == '404' || status == '500'
          Locomotive::ErrorsController.action(:"error_#{status}").call(env)
        else
          super
        end
      end

    end

  end
end