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

FlurlHttpException lacks non-async GetResponse #446

Closed
michaelkhalsa opened this issue May 11, 2019 · 1 comment
Closed

FlurlHttpException lacks non-async GetResponse #446

michaelkhalsa opened this issue May 11, 2019 · 1 comment

Comments

@michaelkhalsa
Copy link

VB.net in framework 4.7.2 on Visual Studio 2019 does not support await within catch block
Thus for FlurlHttpException this is impossible

Catch ex As FlurlHttpException
Dim s = Await ex.GetResponseStringAsync()
...

Flurl 2.8.2
Flurl.Http 2.4.2
There are non-eloquent workarounds, however would be nice to have it back for vb.net code

@tmenier
Copy link
Owner

tmenier commented May 11, 2019

That's disappointing about VB, but I don't want to go back to making that a synchronous call. The way I had to do it previously without blocking was to eagerly read the response stream before throwing the exception, which isn't the most efficient.

The work-around is to use AllowAnyResponseStatus (or similar), check the status on the response, and deserialize it differently depending on whether it was a successful response. #354 will make this easier, and it's a top priority for 3.0.

@tmenier tmenier removed the bug label May 11, 2019
@tmenier tmenier closed this as completed May 17, 2019
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

2 participants