prodot / ReCommended-Extension

Code analysis improvements and context actions
Apache License 2.0
59 stars 11 forks source link

[Question] HttpRequestException #54

Closed NN--- closed 3 years ago

NN--- commented 3 years ago

Why throwing HttpRequestException is prohibited ?

michael-damatov commented 3 years ago

According to the docs the HttpRequestException is the base* class for exceptions thrown by the HttpClient and HttpMessageHandler classes.

*I could not find any derived class in the .NET Framework (checked v4.8 and v5.0.1). The exception class is not sealed, so any library can define derived classes. ** The exception is supposed to be thrown by HttpClient and HttpMessageHandler. Actually, there shouldn't be any reason to throw the exception.

Do you have a good reason to throw the HttpRequestException?

NN--- commented 3 years ago

Yeah I wondered too where are derived classes:) I just used it in my test.