gossamer icon indicating copy to clipboard operation
gossamer copied to clipboard

pkg/scale: define sentinel errors and add error wrapping

Open qdm12 opened this issue 2 years ago • 1 comments

Task summary

The pkg/scale package is cumbersome to use together with error wrapping aware code, since no sentinel error is defined and exported.

All defined errors.New( and fmt.Errorf( constant strings errors should be moved to global scope and exported so callers can use them together with errors.Is(err, scale.ErrXXX). This can be useful for testing packages importing the scale package as well, where the (programmatic) error has to be asserted.

Standard library error wrapping with fmt.Errorf("doing something: %w", err) should also be added at the same time to add more context to errors returned.

qdm12 avatar Jun 29 '22 19:06 qdm12

@qdm12 where in the gossamer codebase do we actually check error types?

timwu20 avatar Aug 06 '22 01:08 timwu20