MCPcopy Index your code
hub / github.com/coder/coder / IsHTTPError

Function IsHTTPError

coderd/idpsync/idpsync.go:227–238  ·  view source on GitHub ↗

IsHTTPError handles us being inconsistent with returning errors as values or pointers.

(err error)

Source from the content-addressed store, hash-verified

225// IsHTTPError handles us being inconsistent with returning errors as values or
226// pointers.
227func IsHTTPError(err error) *HTTPError {
228 var httpErr HTTPError
229 if xerrors.As(err, &httpErr) {
230 return &httpErr
231 }
232
233 var httpErrPtr *HTTPError
234 if xerrors.As(err, &httpErrPtr) {
235 return httpErrPtr
236 }
237 return nil
238}
239
240// HTTPError is a helper struct for returning errors from the IDP sync process.
241// A regular error is not sufficient because many of these errors are surfaced

Callers 3

userOAuth2GithubMethod · 0.92
userOIDCMethod · 0.92
TestIsHTTPErrorFunction · 0.92

Calls 1

AsMethod · 0.80

Tested by 1

TestIsHTTPErrorFunction · 0.74