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

Task/fix null response error #12

Merged
merged 2 commits into from
Oct 28, 2024

Conversation

nebHailemariam
Copy link
Collaborator

Handles cases where the Gorse server returns a null response for GetRecommend(string userId) by returning null instead of throwing an exception, allowing users to manage null responses more flexibly. Additionally, adds a constructor to the GorseException class to pass the error message to the base Exception class, ensuring the error is displayed. Previously, GorseException lacked a constructor to initialize the base message.

Additionally, replace the status code check with a more robust check.

// Checks only for HTTP 200 if (response.StatusCode != HttpStatusCode.OK)

// Checks succes if (!response.IsSuccessStatusCode) { throw new GorseException { StatusCode = response.StatusCode, Message = response.Content };

@zhenghaoz zhenghaoz linked an issue Oct 28, 2024 that may be closed by this pull request
@zhenghaoz
Copy link
Contributor

LGTM

@zhenghaoz zhenghaoz merged commit 3faa9ae into gorse-io:main Oct 28, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

Potential bug: Unexpected Exception for Null Response in Gorse.NET
2 participants