Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How should we handle exceptions? #344

Open
Spone opened this issue Mar 22, 2019 · 3 comments
Open

How should we handle exceptions? #344

Spone opened this issue Mar 22, 2019 · 3 comments

Comments

@Spone
Copy link
Contributor

Spone commented Mar 22, 2019

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 rescueing 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
@pacarvalho
Copy link

pacarvalho commented Jul 23, 2020

@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.

@Spone
Copy link
Contributor Author

Spone commented Jul 23, 2020

@pacarvalho nope :(

Sadly, Algolia is failing its Rails users right now... very few updates here... ping @chloelbn @redox

@andresespinosapc
Copy link

I also need this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants