LabscoMCP early access ↗

In Go a failure is a value handed back up the call stack; this is how to add context to it on the way up, recognise it at the top, and log it exactly once instead of three times.

WHEN TO USE

SCOPE

USE FOR

  • Wrap an error with fmt.Errorf and %w so the caller can unwrap the original cause.
  • Match a sentinel error with errors.Is or pull a typed error out of a chain with errors.As.
  • Fix a log-and-return violation where the same error gets logged twice.
  • Add samber/oops to a production error that needs a stack trace and tenant context.
  • Set up structured slog logging for errors so a log aggregator can group them cleanly.

NOT FOR

  • Not for the full samber/oops API or its builder patterns in depth.
  • Not for the broader slog handler ecosystem beyond basic structured logging.