CheckScimError checks whether the error's status code is defined by SCIM for the given HTTP method.
(err error, method string)
| 133 | |
| 134 | // CheckScimError checks whether the error's status code is defined by SCIM for the given HTTP method. |
| 135 | func 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. |
| 153 | func ScimErrorBadParams(invalidParams []string) ScimError { |
searching dependent graphs…