Skip to content

Commit

Permalink
Fix error message texts
Browse files Browse the repository at this point in the history
Signed-off-by: Abdulbois <abdulbois.tursunov@dsr-corporation.com>
Signed-off-by: Abdulbois <abdulbois123@gmail.com>
  • Loading branch information
Abdulbois committed May 27, 2024
1 parent ccac781 commit de252c1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions types/pki/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ func NewErrCertificateDoesNotExist(subject string, subjectKeyID string) error {
subject, subjectKeyID)
}

func NewErrNocRootCertificateDoesNotExist(subject string, subjectKeyID string) error {
return errors.Wrapf(ErrCertificateDoesNotExist,
"No X509 NOC root certificate associated with the "+
"combination of subject=%v and subjectKeyID=%v on the ledger",
subject, subjectKeyID)
}

func NewErrCertificateBySerialNumberDoesNotExist(subject string, subjectKeyID string, serialNumber string) error {
return errors.Wrapf(ErrCertificateDoesNotExist,
"No X509 certificate associated with the "+
Expand Down
2 changes: 1 addition & 1 deletion x/pki/keeper/msg_server_remove_noc_x_509_root_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (k msgServer) RemoveNocX509RootCert(goCtx context.Context, msg *types.MsgRe
certificates := nocCerts.Certs
certificates = append(certificates, revCerts.Certs...)
if len(certificates) == 0 {
return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId)
return nil, pkitypes.NewErrNocRootCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId)
}

cert := certificates[0]
Expand Down
2 changes: 1 addition & 1 deletion x/pki/keeper/msg_server_revoke_noc_x_509_root_cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func (k msgServer) RevokeNocX509RootCert(goCtx context.Context, msg *types.MsgRe

certificates, _ := k.GetApprovedCertificates(ctx, msg.Subject, msg.SubjectKeyId)
if len(certificates.Certs) == 0 {
return nil, pkitypes.NewErrCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId)
return nil, pkitypes.NewErrNocRootCertificateDoesNotExist(msg.Subject, msg.SubjectKeyId)
}

cert := certificates.Certs[0]
Expand Down

0 comments on commit de252c1

Please sign in to comment.