It would be nice to have some predefined errors like:
var (
ErrNoCertAvailable = errors.New("no certificate available")
ErrSomethingWrong = errors.New("...")
// TBD.
)
So the client code could do:
if errors.Is(err, certmagic.ErrNoCertAvailable) { // Do something here }
So far we have some tricky logic that selects a certificate for the connection, which involves certmagic, static certificates, and some internal tools.
Having the ability to check for particular error would be really helpful.
What would you like to have changed?
|
return Certificate{}, fmt.Errorf("no certificate available for '%s'", name) |
Why is this feature a useful, necessary, and/or important addition to this project?
It allows checking for the specific errors via generic methods like errors.Is
What alternatives are there, or what are you doing in the meantime to work around the lack of this feature?
if strings.Contains(err.Error(), "no certificate available") { ... }
It would be nice to have some predefined errors like:
So the client code could do:
So far we have some tricky logic that selects a certificate for the connection, which involves certmagic, static certificates, and some internal tools.
Having the ability to check for particular error would be really helpful.
What would you like to have changed?
certmagic/handshake.go
Line 404 in d2a7286
Why is this feature a useful, necessary, and/or important addition to this project?
It allows checking for the specific errors via generic methods like
errors.IsWhat alternatives are there, or what are you doing in the meantime to work around the lack of this feature?