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)
| 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. |
| 173 | func 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. |
| 183 | func parseCSR(obj *certificates.CertificateSigningRequest) (*x509.CertificateRequest, error) { |
no test coverage detected