algoliasearch-rails
algoliasearch-rails copied to clipboard
How should we handle exceptions?
The README mentions how to disable exceptions, but not how we should handle them properly, for instance in production. I do not want my update to break if the record is too large for instance.
I'd like to see examples of a recommended way of rescue
ing errors when setting up indexation on my model. I think mentioning it explicitly will encourage developers to handle exceptions properly, and prevent it to blow up in production when they do not expect it.
It would be awesome if we could use rescue
right in the config block, such as this:
class Contact < ActiveRecord::Base
include AlgoliaSearch
algoliasearch do
attribute :first_name, :last_name, :email
rescue Algolia::AlgoliaProtocolError => e
# handle exception properly
end
end
@Spone Have you figured out how to accomplish this? I am looking to log Algolia exceptions to Sentry without breaking the application in production when Algolia cannot be reached.
@pacarvalho nope :(
Sadly, Algolia is failing its Rails users right now... very few updates here... ping @chloelbn @redox
I also need this!