Sha256: 0bafcfdd85a114aabbbd327ec62ae6f5cdaa9ef39be3ddb3afdb1d2121939d9e

Contents?: true

Size: 807 Bytes

Versions: 9

Compression:

Stored size: 807 Bytes

Contents

module Katello
  class ErrorsController < Katello::ApplicationController
    skip_before_filter :require_user, :require_org
    skip_before_filter :authorize # ok - is used by warden

    # handles unknown routes from both / and /api namespaces
    def routing
      path = params['a']
      ex = HttpErrors::NotFound.new(_("Route does not exist:") + " #{path}")

      if path.match('/api/')
        # custom message which will render in JSON
        logger.error ex.message
        respond_to do |format|
          # rubocop:disable SymbolName
          format.json { render :json => {:displayMessage => ex.message, :errors => [ex.message]}, :status => 404 }
          format.all { render :text => "#{ex.message}", :status => 404 }
        end
      else
        render_404 ex
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-2.4.5 app/controllers/katello/errors_controller.rb
katello-2.4.4 app/controllers/katello/errors_controller.rb
katello-2.4.3 app/controllers/katello/errors_controller.rb
katello-2.4.2 app/controllers/katello/errors_controller.rb
katello-2.4.1 app/controllers/katello/errors_controller.rb
katello-2.4.0 app/controllers/katello/errors_controller.rb
katello-2.4.0.rc3 app/controllers/katello/errors_controller.rb
katello-2.4.0.rc2 app/controllers/katello/errors_controller.rb
katello-2.4.0.rc1 app/controllers/katello/errors_controller.rb