In arcade-services and likely also other places, we currently check the message contents of an HttpRequestException to determine if we have a 404, 403, etc. In .NET 5+, a StatusCode property has been added to HttpRequestException, which we should use instead when we are catching these exceptions.
Exception checking in code looks something like this:
catch (HttpRequestException e) when (e.Message.Contains(((int)HttpStatusCode.NotFound).ToString()))
In arcade-services and likely also other places, we currently check the message contents of an HttpRequestException to determine if we have a 404, 403, etc. In .NET 5+, a StatusCode property has been added to HttpRequestException, which we should use instead when we are catching these exceptions.
Exception checking in code looks something like this: