scgolang / osc

Open Sound Control 1.0 for golang
http://godoc.org/github.com/scgolang/osc
MIT License
35 stars 9 forks source link

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

Open vlappa opened 12 months ago

vlappa commented 12 months ago

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

mitar commented 11 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.).

vlappa commented 11 months ago

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

mitar commented 11 months ago

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.

vlappa commented 11 months ago

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

mitar commented 11 months ago

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.