There should never be an answer null- in this case, the author says that WebExceptionhe cannot be handled in this exception handler, and he simply propagates upwards.
However, this exception handling is not ideal - you probably want to know why the exception occurred, i.e.:
catch (WebException ex)
{
if (ex.Status == WebExceptionStatus.ProtocolError && ex.Response != null)
{
var resp = (HttpWebResponse)ex.Response;
if (resp.StatusCode == HttpStatusCode.NotFound)
{
return false;
}
}
throw;
}
source
share