Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP and protocol errors are not nicely passed through SCIM client #51

Open
smoyer64 opened this issue Feb 26, 2020 · 0 comments
Open

Comments

@smoyer64
Copy link
Contributor

smoyer64 commented Feb 26, 2020

If OAuth2 authentication fails (or requires) re-authentication during a SCIM client call ... this error should be put into a SCIMError so that the message (from the entity body) and the status code are both available to the SCIM client library user.

As noted by the title change, this actually applies to any HTTP error that does not include an entity body with the JSON for a SCIMError. In this case, the unmarshaling error should not be returned but rather the HTTP status code (and maybe message) along with the plain text from the entity body should be put into an error and returned. The incorrect code is:

	if resp.StatusCode < 200 || resp.StatusCode > 299 {
		var er ErrorResponse
		err = json.Unmarshal(body, &er)
		if err != nil {
			return err
		}
		return er
	}
@smoyer64 smoyer64 changed the title OAuth2 errors are not nicely passed through SCIM client HTTP and protocol errors are not nicely passed through SCIM client Feb 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant