Skip to content

v1.7.0: New error redaction logic, and more! (API CHANGE)

Choose a tag to compare

@knz knz released this 21 Aug 10:52
· 142 commits to master since this release

The main change in this release is a radical change in how the library internally learns about and treats strings to separate "safe" and "unsafe" information.

Despite the major version bump, only very few APIs have been changed in a backward-incompatible way.
Also, no new strings are considered safe for reporting that were not already before, unlike what happened in v1.6.0.

(For context, "safe" means known not to contain PII, confidential data etc, and thus safe to report to Sentry and other telemetry.)

Highlights

  • More complete error messages in Sentry reports,
  • More details of errors are preserved when they are embedded inside other errors.
  • Several bug fixes in error formatting.
  • A more complete test suite to test error formatting and sentry reports.

Backward-incompatible changes

  • The errors.Safe() function now returns a redact.SafeValue, instead of an errors.SafeMessager as before.

Major changes

  • A new interface errors.SafeFormatter is introduced, and should be preferred to errors.Formatter in the general case.

  • Prior to this release, the only safe strings were error types and the explicit "Safe Details" payloads as implemented by the SafeDetailer interface, errors.WithSafeDetails() and the implicit capture of detail strings by errors.New*() and errors.Wrap*() constructors.

    This machinery has been complemented by the new package https://github.com/cockroachdb/redact (previously introduced in CockroachDB) which is now used throughout the library for error redaction.

    The SafeDetailer interface and corresponding safe strings are still supported (and reported in Sentry if found). Backward-compatible safe detail strings are also generated by the new redact-based code for the benefit of networked code using mixed library versions.