Commit 9ba90ad51512a65fe3168bc85ee03285413be8d1
1 parent
4008b724
Exists in
master
and in
21 other branches
Fixed friendly error messages
Showing
1 changed file
with
8 additions
and
9 deletions
Show diff stats
lib/searchkick/query.rb
@@ -317,15 +317,14 @@ module Searchkick | @@ -317,15 +317,14 @@ module Searchkick | ||
317 | begin | 317 | begin |
318 | response = Searchkick.client.search(params) | 318 | response = Searchkick.client.search(params) |
319 | rescue => e # TODO rescue type | 319 | rescue => e # TODO rescue type |
320 | - # status_code = e.message[0..3].to_i | ||
321 | - # if status_code == 404 | ||
322 | - # raise "Index missing - run #{searchkick_klass.name}.reindex" | ||
323 | - # elsif status_code == 500 and (e.message.include?("IllegalArgumentException[minimumSimilarity >= 1]") or e.message.include?("No query registered for [multi_match]")) | ||
324 | - # raise "Upgrade Elasticsearch to 0.90.0 or greater" | ||
325 | - # else | ||
326 | - # raise e | ||
327 | - # end | ||
328 | - raise e | 320 | + status_code = e.message[1..3].to_i |
321 | + if status_code == 404 | ||
322 | + raise "Index missing - run #{searchkick_klass.name}.reindex" | ||
323 | + elsif status_code == 500 and (e.message.include?("IllegalArgumentException[minimumSimilarity >= 1]") or e.message.include?("No query registered for [multi_match]") or e.message.include?("[match] query does not support [cutoff_frequency]]")) | ||
324 | + raise "Upgrade Elasticsearch to 0.90.0 or greater" | ||
325 | + else | ||
326 | + raise e | ||
327 | + end | ||
329 | end | 328 | end |
330 | 329 | ||
331 | # apply facet limit in client due to | 330 | # apply facet limit in client due to |