You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would use the standard error interface instead of a custom one. It's designed to contain custom error types like we have here and ensures compatibility with other go code.
For line 62 there is an idiomatic way of checking an error type:
var errFailed ErrorFailed
if ok := errors.As(err, errFailed); ok {
...
}
It's more robust - if the err value is ever created in a non-main pkg then the %T won't be main.ErrorFailed.
I would use the standard
error
interface instead of a custom one. It's designed to contain custom error types like we have here and ensures compatibility with other go code.For line 62 there is an idiomatic way of checking an error type:
It's more robust - if the
err
value is ever created in a non-main pkg then the %T won't bemain.ErrorFailed
.The go blog is not bad for going through the idiomatic way to do errors in go 1.13+ https://blog.golang.org/go1.13-errors
Originally posted by @rhuairahrighairidh in #2
The text was updated successfully, but these errors were encountered: