Add context to errors

This commit is contained in:
Mariano Cano 2022-09-21 18:46:34 -07:00
parent 72e2c4eb2e
commit d68c765e20

View file

@ -214,7 +214,7 @@ func (a *Authority) Sign(csr *x509.CertificateRequest, signOpts provisioner.Sign
if err := a.isAllowedToSignX509Certificate(leaf); err != nil {
var ee *errs.Error
if errors.As(err, &ee) {
return nil, ee
return nil, errs.ApplyOptions(ee, opts...)
}
return nil, errs.InternalServerErr(err,
errs.WithKeyVal("csr", csr),
@ -353,7 +353,7 @@ func (a *Authority) Rekey(oldCert *x509.Certificate, pk crypto.PublicKey) ([]*x5
if err := a.isAllowedToSignX509Certificate(newCert); err != nil {
var ee *errs.Error
if errors.As(err, &ee) {
return nil, ee
return nil, errs.ApplyOptions(ee, opts...)
}
return nil, errs.InternalServerErr(err,
errs.WithKeyVal("serialNumber", oldCert.SerialNumber.String()),