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

Support suppressed errors using "@" to ignore exceptions #537

Merged
merged 2 commits into from
Aug 27, 2019

Conversation

tomlongridge
Copy link
Contributor

@tomlongridge tomlongridge commented Aug 19, 2019

Goal

Exception reporting can be suppressed for an expression by prefixing it with the error control operator "@". This is correctly ignored by the notifier if the error reporting level is not configured in the library but it is not suppressed if an error reporting level has been configured.

The PHP documentation states that custom error handlers:

can (and should) call error_reporting()

Therefore this change ensures that suppressed errors are always ignored and not reported to Bugsnag.

Changeset

Changed

  • Configuration - amended shouldIgnoreErrorCode to return true in all cases if the error is suppressed (i.e. error_reporting() returns 0).

Tests

Added extra tests for this functionality - including mocking the error_reporting global function.

Linked issues

Fixes bugsnag/bugsnag-wordpress#35.

Review

For the submitter, initial self-review:

  • Commented on code changes inline explain the reasoning behind the approach
  • Reviewed the test cases added for completeness and possible points for discussion
  • A changelog entry was added for the goal of this pull request
  • Check the scope of the changeset - is everything in the diff required for the pull request?
  • This pull request is ready for:
    • Initial review of the intended approach, not yet feature complete
    • Structural review of the classes, functions, and properties modified
    • Final review

For the pull request reviewer(s), this changeset has been reviewed for:

  • Consistency across platforms for structures or concepts added or modified
  • Consistency between the changeset and the goal stated above
  • Internal consistency with the rest of the library - is there any overlap between existing interfaces and any which have been added?
  • Usage friction - is the proposed change in usage cumbersome or complicated?
  • Performance and complexity - are there any cases of unexpected O(n^3) when iterating, recursing, flat mapping, etc?
  • Concurrency concerns - if components are accessed asynchronously, what issues will arise
  • Thoroughness of added tests and any missing edge cases
  • Idiomatic use of the language

@tomlongridge tomlongridge force-pushed the tom/suppressed_errors_shouldnt_notify branch from 4145b4b to a666eed Compare August 19, 2019 10:13
…trol operator (@)

Events should no longer be sent if the @-symbol is prepended to an expression. This is
determined by error_reporting global function returning 0.

Fixes bugsnag-wordpress#35
@tomlongridge tomlongridge force-pushed the tom/suppressed_errors_shouldnt_notify branch from a666eed to 1f37407 Compare August 19, 2019 10:16
@tomlongridge tomlongridge marked this pull request as ready for review August 19, 2019 10:24
@tomlongridge tomlongridge requested a review from Cawllec August 19, 2019 10:24
@tomlongridge tomlongridge merged commit 69696f6 into next Aug 27, 2019
@tomlongridge tomlongridge deleted the tom/suppressed_errors_shouldnt_notify branch August 27, 2019 11:35
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

Successfully merging this pull request may close these issues.

2 participants