wealdtech / go-ens

Apache License 2.0
90 stars 33 forks source link

Proposal: Define Error Variables #31

Open uji opened 1 year ago

uji commented 1 year ago

I’d like to allow library users to distinguish user caused errors and library or rpc caused errors. This allows for better error handling by the user.

For example, in go-sql-driver/mysql, errors are defined by variables. https://github.com/go-sql-driver/mysql/blob/ad9fa14acdcf7d0533e7fbe58728f3d216213ade/errors.go#L18-L31

In addition, complex ones are expressed by defining dedicated types. https://github.com/go-sql-driver/mysql/blob/ad9fa14acdcf7d0533e7fbe58728f3d216213ade/errors.go#L57-L62