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

Recover and RecoverWithContext with arbitrary types #268

Merged
merged 5 commits into from
Jul 21, 2020

Commits on Jul 20, 2020

  1. Configuration menu
    Copy the full SHA
    38facca View commit details
    Browse the repository at this point in the history
  2. feat: Support calling Client.Recover* with a nil hint

    While Client.Recover and Client.RecoverWithContext are mostly meant to
    be internal methods called by methods with the same name on Hub, they
    are part of the exported API on Client.
    
    This commit avoids a runtime panic when those methods are called with a
    nil *EventHint.
    rhcarvalho committed Jul 20, 2020
    Configuration menu
    Copy the full SHA
    400d1e6 View commit details
    Browse the repository at this point in the history

Commits on Jul 21, 2020

  1. Configuration menu
    Copy the full SHA
    6236d6b View commit details
    Browse the repository at this point in the history
  2. ref: Implement Recover on top of RecoverWithContext

    This eliminates some code duplication.
    
    Note that it is important to keep the call to recover in the body of the
    function itself, because the Go spec defines that the return value of
    recover is (always) nil if it was not called directly by a deferred
    function.
    rhcarvalho committed Jul 21, 2020
    Configuration menu
    Copy the full SHA
    fa9ada0 View commit details
    Browse the repository at this point in the history
  3. fix: Recover* report errors for any type of panic

    The previous behavior was to silently stop panics without reporting to
    Sentry when the return value from recover() was not an error or a
    string.
    
    Runtime panics are specified to implement the predefined error
    interface, and string is probably the second most common type passed to
    panic() calls, still calls like panic(42) should not pass silently.
    
    This fix converts any other type to string using Go's standard
    formatting rules and reports the message to Sentry.
    rhcarvalho committed Jul 21, 2020
    Configuration menu
    Copy the full SHA
    e1bfbd4 View commit details
    Browse the repository at this point in the history