zerolog icon indicating copy to clipboard operation
zerolog copied to clipboard

(#470) Localize github.com/pkg/errors

Open vaguecoder opened this issue 3 years ago • 3 comments

Motivation

Issue #470 reported by @skormos

Changes

Adds new internal package errors with test coverage.

Summary

Localizes following functions (and required types and methods) from github.com/pkg/errors as it is no longer being maintained.

New(message string) error
Wrap(err error, message string) error

Related Issues

Closes #470 Helps in #462

vaguecoder avatar Sep 07 '22 09:09 vaguecoder

After this change, as we do not expose the errors.Wrap, how are users supposed to use this feature?

rs avatar Sep 12 '22 19:09 rs

@rs I totally missed that Wrap is required by users. Can it be included in the same package as MarshalStack? I understand that it means extending pkgerrors layer.

vaguecoder avatar Sep 12 '22 19:09 vaguecoder

Reading the change I'm not really fan of the resulting API. I wonder if we could keep backward compat (when getting a wrapped error) and at the same time, auto-wrap an error when Stack is present and Err is called. This way we do not expose a new API.

rs avatar Sep 13 '22 10:09 rs