#129·errors

PROPOSAL: Allow hiding part of the stack trace

Author: decibelCreated Aug 4, 2017Updated Aug 23, 2021

Taking inspiration from how pkg/errors is meant as a drop-in replacement for the standard errors package, I have created an errors package that's specific to a larger project I'm involved in. That makes it easy to customize error behavior in the future. This package is mostly thin wrappers around pkg/errors.

The one downside to this is the stacks end up with an extra layer. Obviously I could fix that, but as far as I can tell it would require a fair amount of code duplication with pkg/errors.

I think there is a fairly easy way around this though; add an exposedStack *stack to withStack{}, and allow for callers to modify the boundaries of exposedStack. By default, exposedStack would be stack[:] so everything would work as today.

I think this would also make it easier for someone to satisfy #111, since they wouldn't need to duplicate any of the printing or other interfaces.