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

Parse response body when Web API returns an error? #778

Open
RudeySH opened this issue Nov 3, 2019 · 0 comments
Open

Parse response body when Web API returns an error? #778

RudeySH opened this issue Nov 3, 2019 · 0 comments

Comments

@RudeySH
Copy link
Contributor

RudeySH commented Nov 3, 2019

A previous release made it possible to find the status code when Web API returns an error (#517). I would now like to be able to parse the response body of the request when an error occurs.

It turns out Steam sometimes returns the same status code for different kinds of errors. The response body will contain a distinct message, though. For example, when calling ISteamUserStats/GetPlayerAchievements, Steam could respond with a 403 (Forbidden), which either means that the request was rate-limited, or it could mean that the player has a private profile. When the latter occurs, the response body looks like this:

{
    "playerstats": {
        "error": "Profile is not public",
        "success": false
    }
}

Can WebAPIRequestException or SteamKitWebRequestException be extended to include a KeyValue property for the response body?

@RudeySH RudeySH changed the title Parse response when Web API returns an error? Parse response body when Web API returns an error? Nov 3, 2019
@yaakov-h yaakov-h self-assigned this Feb 11, 2020
@yaakov-h yaakov-h added this to the 2.4.0 milestone Jul 14, 2020
@yaakov-h yaakov-h added this to To do in 2.4.0 Release via automation Jul 14, 2020
@yaakov-h yaakov-h modified the milestones: 2.4.0, 2.5.0 Nov 15, 2021
@yaakov-h yaakov-h removed this from To do in 2.4.0 Release Nov 17, 2021
@yaakov-h yaakov-h added this to To do in Things that need fixing via automation Nov 17, 2021
@xPaw xPaw modified the milestones: 2.5.0, Some day (PRs welcome) Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants