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

GetFromJsonAsync should have proper list of thrown exceptions #10732

Open
LeftTwixWand opened this issue Dec 7, 2024 · 3 comments
Open

GetFromJsonAsync should have proper list of thrown exceptions #10732

LeftTwixWand opened this issue Dec 7, 2024 · 3 comments
Labels
area-System.Text.Json Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner

Comments

@LeftTwixWand
Copy link

Describe the issue or suggestion

Currently, httpClient.GetFromJsonAsync documentation shows, that the only one thrown exception is OperationCancelledException.
But it's not true and there is at least HttpRequestException which contains status code.
And might be JsonException as well.

I think, it would be quite useful to include more exceptions into the docs.
Why this was inconvenient for me - I can't write proper resiliency policies because I don't know the excections, which are thrown by default.
Image

@issues-automation issues-automation bot added the Pri3 Indicates issues/PRs that are low priority label Dec 7, 2024
@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Dec 7, 2024
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

1 similar comment
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 7, 2024
@CarnaViire CarnaViire added area-System.Text.Json and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Dec 10, 2024
@eiriktsarpalis
Copy link
Member

Ultimately, GetFromJsonAsync is just an accelerator method that can surface exceptions from a number of components containing abstractions:

  1. The HttpClientHadler implementation used by HttpClient
  2. Any JsonConverter<T> implementations used by JsonSerializer.

We don't typically document failure modes that could potentially surface from abstractions, since it may produce exceptions of any type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Text.Json Pri3 Indicates issues/PRs that are low priority untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

3 participants