osc icon indicating copy to clipboard operation
osc copied to clipboard

remove dependency https://github.com/pkg/errors

Open vlappa opened this issue 2 years ago • 5 comments
trafficstars

Handle errors as discussed here: https://go.dev/blog/go1.13-errors

vlappa avatar Sep 15 '23 10:09 vlappa

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.).

mitar avatar Oct 08 '23 23:10 mitar

My preference would be to avoid external libraries which are not part of the standard library as much as possible.

vlappa avatar Oct 08 '23 23:10 vlappa

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.

mitar avatar Oct 08 '23 23:10 mitar

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".

vlappa avatar Oct 12 '23 22:10 vlappa

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.

mitar avatar Oct 12 '23 22:10 mitar