MCPcopy
hub / github.com/cloudfoundry/cli / processRequestErrors

Method processRequestErrors

api/plugin/plugin_connection.go:101–122  ·  view source on GitHub ↗

processRequestError handles errors that occur while making the request.

(request *http.Request, err error)

Source from the content-addressed store, hash-verified

99
100// processRequestError handles errors that occur while making the request.
101func (connection *PluginConnection) processRequestErrors(request *http.Request, err error) error {
102 switch e := err.(type) {
103 case *url.Error:
104 if errors.As(err, &x509.UnknownAuthorityError{}) {
105 return pluginerror.UnverifiedServerError{
106 URL: request.URL.String(),
107 }
108 }
109
110 hostnameError := x509.HostnameError{}
111 if errors.As(err, &hostnameError) {
112 return pluginerror.SSLValidationHostnameError{
113 Message: hostnameError.Error(),
114 }
115 }
116
117 return pluginerror.RequestError{Err: e}
118
119 default:
120 return err
121 }
122}

Callers 1

MakeMethod · 0.95

Calls 2

StringMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected