top | item 44149373

(no title)

vikeri | 9 months ago

One thing that seemingly is missing is the ability to tag a specific error with an error code. You typically want to know that all of a sudden the ”failed to get user” error is being returned a lot. Since the message is a dynamic string you can’t just group by the string so unless you build it as part of your abstraction it becomes very hard to do.

Edit: looking more carefully at the lib I assume that ”tag” is the concept that is supposed to cover this?

discuss

order

arccy|9 months ago

in standard go you'd have errors implement:

    func (myError) Is(err error) bool
and it can match different sentinel errors. Or you can make your own wrapper to have the error chain match.

zarldev|9 months ago

In standard go you would not implement Is but would use the errors.Is call. How would this work if it is a sentinel error as you would use with errors.Is??