1package data 2 3import "fmt" 4 5// ErrInvalidMetadata is the error to be returned when metadata is invalid 6type ErrInvalidMetadata struct { 7 role RoleName 8 msg string 9} 10 11func (e ErrInvalidMetadata) Error() string { 12 return fmt.Sprintf("%s type metadata invalid: %s", e.role.String(), e.msg) 13} 14 15// ErrMissingMeta - couldn't find the FileMeta object for the given Role, or 16// the FileMeta object contained no supported checksums 17type ErrMissingMeta struct { 18 Role string 19} 20 21func (e ErrMissingMeta) Error() string { 22 return fmt.Sprintf("no checksums for supported algorithms were provided for %s", e.Role) 23} 24 25// ErrInvalidChecksum is the error to be returned when checksum is invalid 26type ErrInvalidChecksum struct { 27 alg string 28} 29 30func (e ErrInvalidChecksum) Error() string { 31 return fmt.Sprintf("%s checksum invalid", e.alg) 32} 33 34// ErrMismatchedChecksum is the error to be returned when checksum is mismatched 35type ErrMismatchedChecksum struct { 36 alg string 37 name string 38 expected string 39} 40 41func (e ErrMismatchedChecksum) Error() string { 42 return fmt.Sprintf("%s checksum for %s did not match: expected %s", e.alg, e.name, 43 e.expected) 44} 45 46// ErrCertExpired is the error to be returned when a certificate has expired 47type ErrCertExpired struct { 48 CN string 49} 50 51func (e ErrCertExpired) Error() string { 52 return fmt.Sprintf("certificate with CN %s is expired", e.CN) 53} 54