Module: Blacklight::Base

Extended by:
ActiveSupport::Concern
Includes:
Configurable, SearchContext, SearchHelper
Included in:
Catalog
Defined in:
app/controllers/concerns/blacklight/base.rb

Constant Summary

Constants included from RequestBuilders

RequestBuilders::DEFAULT_FACET_LIMIT

Instance Attribute Summary

Attributes included from Configurable

#blacklight_config

Instance Method Summary collapse

Methods included from SearchContext

#add_to_search_history, #agent_is_crawler?, #blacklisted_search_session_params, #current_search_session, #find_or_initialize_search_session_from_params, #find_search_session, #search_session, #set_current_search_session, #setup_next_and_previous_documents, #start_new_search_session?

Methods included from SearchHelper

#fetch, #get_facet_field_response, #get_opensearch_response, #get_previous_and_next_documents_for_search, #grouped_key_for_results, #repository, #search_results

Methods included from RequestBuilders

#facet_limit_for, #previous_and_next_document_params, #search_builder, #solr_opensearch_params

Methods included from Configurable

default_configuration, default_configuration=

Instance Method Details

#handle_request_error(exception) ⇒ Object (protected)

when The index throws an error (Blacklight::Exceptions::InvalidRequest), this method is executed.



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/concerns/blacklight/base.rb', line 20

def handle_request_error(exception)
  if Rails.env.development? || Rails.env.test?
    raise exception # Rails own code will catch and give usual Rails error page with stack trace
  else

    flash_notice = I18n.t('blacklight.search.errors.request_error')

    # If there are errors coming from the index page, we want to trap those sensibly

    if flash[:notice] == flash_notice
      logger.error "Cowardly aborting rsolr_request_error exception handling, because we redirected to a page that raises another exception"
      raise exception
    end

    logger.error exception

    flash[:notice] = flash_notice 
    redirect_to root_path
  end
end