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

Added support for skip_bugsnag flag on exceptions #402

Merged
merged 1 commit into from Dec 11, 2017

Conversation

Cawllec
Copy link
Contributor

@Cawllec Cawllec commented Nov 24, 2017

Adds supports for setting a skip_bugsnag flag on exceptions to allow re-raising after notifying as requested in #345

@Cawllec Cawllec added the feature request Request for a new feature label Nov 24, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.07%) to 76.931% when pulling 118e9ff on cawllec/allow-re-raise-errors into bbef3cc on master.

@kattrali kattrali merged commit 2925f69 into master Dec 11, 2017
@kattrali kattrali deleted the cawllec/allow-re-raise-errors branch December 11, 2017 15:33
@snmaynard
Copy link
Contributor

Why add this rather than advise the use of bugsnag_meta_data? This will report the exception as handled, when infact it is unhandled.

@Cawllec
Copy link
Contributor Author

Cawllec commented Dec 11, 2017

For the particular use case of the guy in #345 just using the bugsnag_meta_data wouldn't necessarily solve his problem, whereas this allows specific individual exceptions to be skipped if required.

@snmaynard
Copy link
Contributor

It would solve his problem - he could attach the metadata and then reraise

@javierjulio
Copy link

javierjulio commented May 10, 2018

@snmaynard when you refer to bugsnag_meta_data, do you mean I should do the following to avoid double notification if I end up re-raising the error?

rescue SomeStandardErrorClass => error
  Bugsnag.notify(error, { skip_bugsnag: true })
  raise error
end

The Bugsnag docs state setting a skip_bugsnag property on an error class which I realize now doesn't make any sense since where I tend to do this type of handling is for third party code (e.g. API client library) where I can't set that. The method is not defined. Stupid mistake on my part.

Would the metadata approach work in the example I gave? Should the docs example be updated?

@snmaynard
Copy link
Contributor

I think you would want to do something like this,

rescue SomeStandardErrorClass => error
  Bugsnag.notify(error)
  error.define_singleton_method(:skip_bugsnag) {true}
  raise error
end

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

Successfully merging this pull request may close these issues.

None yet

5 participants