Skip to content

Commit

Permalink
When SearchBuilder has a NameError raise it.
Browse files Browse the repository at this point in the history
Previously the rescue block was hiding the error and saying that
SearchBuilder could not be found.
  • Loading branch information
jcoyne committed Aug 6, 2015
1 parent e3969b7 commit d98bd82
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/blacklight/configuration.rb
Expand Up @@ -225,7 +225,12 @@ def search_builder_class

def locate_search_builder_class
::SearchBuilder
rescue NameError
rescue NameError => e
# If the NameError is a result of the SearchBuilder having a
# NameError (e.g. NoMethodError) within it then raise the error.
raise e if Object.const_defined? "::SearchBuilder"

# Otherwise the NameError was a result of not being able to find SearchBuilder
Deprecation.warn(Configuration, "Your application is missing the SearchBuilder. Have you run `rails generate blacklight:search_builder`? Falling back to Blacklight::Solr::SearchBuilder")
Blacklight::Solr::SearchBuilder
end
Expand Down

0 comments on commit d98bd82

Please sign in to comment.