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 wrapped errors #504

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Commits on May 2, 2024

  1. Support wrapped errors

    Wrapping errors instead of merely embedding error messages allows
    calling code to use `errors.Is` and `errors.As` to more precisely check
    the reasons for various errors instead of having to rely only on
    substring searches.
    
    We implement our own wrapper error to retain backward compatibility
    prior to Go 1.13, where there is no support for the "%w" format string
    in `fmt.Errorf`.
    rkennedy committed May 2, 2024
    Configuration menu
    Copy the full SHA
    549c144 View commit details
    Browse the repository at this point in the history

Commits on May 4, 2024

  1. Move WrapError to internal package

    There's no particular reason to make error-wrapping be part of Mage's
    public interface, so now it's kept in the internal package. One
    consolation was needed to avoid circular imports, which is that when
    `mg.F` panics, it does not _wrap_ the JSON-marshalling error.
    rkennedy committed May 4, 2024
    Configuration menu
    Copy the full SHA
    d3f41c5 View commit details
    Browse the repository at this point in the history

Commits on May 5, 2024

  1. Streamline wrapped error formatting

    Instead of having the caller create an error with fmt.Errorf and then
    pass it to WrapError, we now have WrapErrorf that wraps the error and
    formats a string error at once.
    rkennedy committed May 5, 2024
    Configuration menu
    Copy the full SHA
    383639d View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    064a13a View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2024

  1. Configuration menu
    Copy the full SHA
    799170f View commit details
    Browse the repository at this point in the history