Skip to content
This repository has been archived by the owner on Dec 21, 2019. It is now read-only.

Update error handling to use exported error types instead of relying on checking the string #31

Open
flexd opened this issue May 10, 2016 · 0 comments

Comments

@flexd
Copy link

flexd commented May 10, 2016

Checking the string is a very bad idea, and it is a much better idea to create exported error types, such as ErrorAlreadyAuthenticated that we can check for instead of relying on checking the string contents of err.Error(). err.Error() is for the user to read, not the machines.

http://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully is a good read detailing how it's best to go about this. :-)

He is also involved in a package that follows the rules he suggests in the blogpost https://github.com/pkg/errors

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

No branches or pull requests

2 participants