Open vlappa opened 12 months ago
Shameless plug: you can also switch it to drop-in replacement gitlab.com/tozd/go/errors
. It fixes many issues, is maintained, and supports modern Go's error patterns (sentinel errors, %w
formating, joined errors, etc.).
My preference would be to avoid external libraries which are not part of the standard library as much as possible.
That is hard to do if you want stack traces with errors, for example. But otherwise yes, standard errors package now is pretty useful on its own as well.
When this library reports a error, you don't clearly see that the reported error is coming from this library. I wonder how other libraries handle it, or whether there is a convention for it.
For example, now we get "invalid OSC address", what if it had a keyword like "osc: invalid OSC address".
The library should probably export sentinel errors so that callers can use errors.Is
or errors.As
to determine where the error is coming from.
Handle errors as discussed here: https://go.dev/blog/go1.13-errors