MCPcopy Create free account
hub / github.com/elimity-com/scim / CheckScimError

Function CheckScimError

errors/error.go:135–150  ·  view source on GitHub ↗

CheckScimError checks whether the error's status code is defined by SCIM for the given HTTP method.

(err error, method string)

Source from the content-addressed store, hash-verified

133
134// CheckScimError checks whether the error's status code is defined by SCIM for the given HTTP method.
135func CheckScimError(err error, method string) ScimError {
136 scimErr, ok := err.(ScimError)
137 if !ok {
138 return ScimError{
139 Detail: err.Error(),
140 Status: http.StatusInternalServerError,
141 }
142 }
143 if !checkApplicability(scimErr, method) {
144 return ScimError{
145 Detail: fmt.Sprintf("The HTTP status code %d is not applicable to the %s-operation.", scimErr.Status, method),
146 Status: http.StatusInternalServerError,
147 }
148 }
149 return scimErr
150}
151
152// ScimErrorBadParams returns an 400 SCIM error with a detailed message based on the invalid parameters.
153func ScimErrorBadParams(invalidParams []string) ScimError {

Callers 8

resourceDeleteHandlerMethod · 0.92
resourceGetHandlerMethod · 0.92
resourcePatchHandlerMethod · 0.92
resourcePostHandlerMethod · 0.92
resourcePutHandlerMethod · 0.92
resourcesGetHandlerMethod · 0.92
TestCheckErrorFunction · 0.85
TestCheckScimErrorFunction · 0.85

Calls 2

checkApplicabilityFunction · 0.85
ErrorMethod · 0.80

Tested by 2

TestCheckErrorFunction · 0.68
TestCheckScimErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…