MCPcopy
hub / github.com/kubernetes/client-go / formatError

Function formatError

util/certificate/csr/csr.go:173–180  ·  view source on GitHub ↗

formatError preserves the type of an API message but alters the message. Expects a single argument format string, and returns the wrapped error.

(format string, err error)

Source from the content-addressed store, hash-verified

171// formatError preserves the type of an API message but alters the message. Expects
172// a single argument format string, and returns the wrapped error.
173func formatError(format string, err error) error {
174 if s, ok := err.(errors.APIStatus); ok {
175 se := &errors.StatusError{ErrStatus: s.Status()}
176 se.ErrStatus.Message = fmt.Sprintf(format, se.ErrStatus.Message)
177 return se
178 }
179 return fmt.Errorf(format, err)
180}
181
182// parseCSR extracts the CSR from the API object and decodes it.
183func parseCSR(obj *certificates.CertificateSigningRequest) (*x509.CertificateRequest, error) {

Callers 2

RequestCertificateFunction · 0.85
WaitForCertificateFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected