-
Notifications
You must be signed in to change notification settings - Fork 55
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
Adds config option exclude_errors #342
Conversation
CI build has failed, but it seems to be an issue with the CI itself and not my changes as far as I can tell. |
@sezaru If I override the default configuration to exclude errors, none of the exception will be sent. How is this supposed to work? |
Hi @TraceyOnim , I don't know if I understood your question correctly. do you mean that exceptions are handled differently inside Honeybadger? When I looked into the code I only found one way to send the errors.
Assuming that the exceptions are handled in the same part that I changed in the code, the answer would be yes, the user would receive the full |
Yeah you got my question , it's now clear .Thank you for the clarification |
Is this something that is planned to be introduced at some point? Is there another way to do "error exclusion"? |
@jdubya80 there isn't another way, and I'm all for including this. @sezaru do you want to add some tests for this? I think it looks good otherwise. I might want to extend this in the future so that the default implementation will ignore a list of error names if you configure something like this: |
* Adds config option exclude_errors * Changes if not with unless. Co-authored-by: Tracey Onim <43263401+TraceyOnim@users.noreply.github.com> * add test for exclude_error implementation * support list of errors and ExcludeError module to exclude_error option * update configuration docs * update changelog * support error classes * Update CHANGELOG.md Co-authored-by: Joshua Wood <josh@joshuawood.net> * update README * Update README.md Co-authored-by: Pangratios Cosma <pagcosma@gmail.com> Co-authored-by: Eduardo Barreto Alexandre <sezdocs@gmail.com> Co-authored-by: Tracey Onim <43263401+TraceyOnim@users.noreply.github.com> Co-authored-by: TraceyOnim <traceyonim22@gmail.com> Co-authored-by: Pangratios Cosma <pagcosma@gmail.com>
This PR adds support to exclude errors from being sent to the Honeybadger servers. This was discussed in issue #308.
My approach was to make this as simple as possible and not opinative, giving the full responsibility and power to the user to exclude errors in their desired way.
This is done by implementing the
Honeybadger.ExcludeErrors
behaviour functionexclude_error?/1
, this function receives the fullHoneybadger.Notice
and should return a boolean signalling the error exclusion or not.By default, the library will not exclude any errors from being sent.
Note that tests are missing because I first want to know that the changes are ok to you guys.
Also note that this can be easily expanded in the future to ship with more exclusion implementations out-of-box, as an example, I will post bellow my full implementation for a rate-limit exclusion strategy where I limit the number of messages per error that can be sent in a time window:
exclude_errors.ex:
exclude_errors/server.ex:
exclude_errors/impl.ex:
exclude_errors/state.ex: