Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use standard error interface for Claimer bot #3

Open
denalimarsh opened this issue Aug 5, 2020 · 0 comments
Open

Use standard error interface for Claimer bot #3

denalimarsh opened this issue Aug 5, 2020 · 0 comments

Comments

@denalimarsh
Copy link
Contributor

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.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant