6 ms·
Sentinel errors are only one way, and definitely not the best way imo. `errors.As` gets you the ability to recursively and multierror-safely check to see if som
by andrewstuart2 4y ago
Sentinel errors are only one way, and definitely not the best way imo. `errors.As` gets you the ability to recursively and multierror-safely check to see if somewhere in the stack, an error of a certain type is found, and access its extra data, to determine e.g. which status code is most appropriate based on any extra data in that type.
I think shared types from a package make a ton of sense and are really practical for writing flexible and maintainable code.