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

errbase: prevent a call cycle for Formatter/SafeFormatter errors #90

Merged
merged 1 commit into from
Jan 18, 2022

Commits on Jan 18, 2022

  1. errbase: prevent a call cycle for Formatter/SafeFormatter errors

    We've found a need somewhere to implement an `Error()` method on a
    leaf by delegating the behavior to the `Formatter` or `SafeFormatter`
    interfaces. In that case, the `errors.IsAny` call inside the
    special handler causes a call cycle.
    
    This commit breaks the cycle by handling the special cases after
    the interfaces.
    
    A possible regression would be that one of the stdlib errors
    starts implementing `fmt.Formatter`, whereby we'd lose the special
    handling (which, as of this writing, extracts safe strings).
    At the time of this writing, none of the stdlib errors of interest
    implement `fmt.Formatter`, so we're punting dealing with that
    when/if it arises in the future.
    knz committed Jan 18, 2022
    Configuration menu
    Copy the full SHA
    8437610 View commit details
    Browse the repository at this point in the history