Remove core.XXXError type checks

This commit is contained in:
Roland Bracewell Shoemaker 2017-05-03 22:18:13 +00:00
parent 40663ba66c
commit 636a1fc878
2 changed files with 3 additions and 9 deletions

View File

@ -67,9 +67,7 @@ func checkDER(sai certificateStorage, der []byte) error {
if err == nil { if err == nil {
return errAlreadyExists return errAlreadyExists
} }
// TODO(#2600): Remove core.NotFoundError check once boulder/errors if berrors.Is(err, berrors.NotFound) {
// code is deployed
if _, ok := err.(core.NotFoundError); ok || berrors.Is(err, berrors.NotFound) {
return nil return nil
} }
return fmt.Errorf("Existing certificate lookup failed: %s", err) return fmt.Errorf("Existing certificate lookup failed: %s", err)

View File

@ -470,9 +470,7 @@ func (wfe *WebFrontEndImpl) verifyPOST(ctx context.Context, logEvent *requestEve
// Special case: If no registration was found, but regCheck is false, use an // Special case: If no registration was found, but regCheck is false, use an
// empty registration and the submitted key. The caller is expected to do some // empty registration and the submitted key. The caller is expected to do some
// validation on the returned key. // validation on the returned key.
// TODO(#2600): Remove core.NoSuchRegistrationError check once boulder/errors if berrors.Is(err, berrors.NotFound) && !regCheck {
// code is deployed
if _, ok := err.(core.NoSuchRegistrationError); (ok || berrors.Is(err, berrors.NotFound)) && !regCheck {
// When looking up keys from the registrations DB, we can be confident they // When looking up keys from the registrations DB, we can be confident they
// are "good". But when we are verifying against any submitted key, we want // are "good". But when we are verifying against any submitted key, we want
// to check its quality before doing the verify. // to check its quality before doing the verify.
@ -486,9 +484,7 @@ func (wfe *WebFrontEndImpl) verifyPOST(ctx context.Context, logEvent *requestEve
// For all other errors, or if regCheck is true, return error immediately. // For all other errors, or if regCheck is true, return error immediately.
wfe.stats.Inc("Errors.UnableToGetRegistrationByKey", 1) wfe.stats.Inc("Errors.UnableToGetRegistrationByKey", 1)
logEvent.AddError("unable to fetch registration by the given JWK: %s", err) logEvent.AddError("unable to fetch registration by the given JWK: %s", err)
// TODO(#2600): Remove core.NoSuchRegistrationError check once boulder/errors if berrors.Is(err, berrors.NotFound) {
// code is deployed
if _, ok := err.(core.NoSuchRegistrationError); ok || berrors.Is(err, berrors.NotFound) {
return nil, nil, reg, probs.Unauthorized(unknownKey) return nil, nil, reg, probs.Unauthorized(unknownKey)
} }