Updated error messages verifying DigiCert profile. (#27342)

For #26622

Updating DigiCert error messages after discussion with Gabe.
This commit is contained in:
Victor Lyuboslavsky 2025-03-20 13:24:29 -05:00 committed by GitHub
parent c0dcf686cc
commit 49d4c1f7d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -77,7 +77,14 @@ func (s *Service) VerifyProfileID(ctx context.Context, config fleet.DigiCertInte
}
defer resp.Body.Close()
if resp.StatusCode != http.StatusOK {
switch resp.StatusCode {
case http.StatusOK:
// all good
case http.StatusUnauthorized:
return ctxerr.Errorf(ctx, "most likely invalid API token; status code: %d", resp.StatusCode)
case http.StatusForbidden:
return ctxerr.Errorf(ctx, "most likely invalid profile GUID; status code: %d", resp.StatusCode)
default:
return ctxerr.Errorf(ctx, "unexpected DigiCert status code: %d", resp.StatusCode)
}