Fixed determination of WebException

There should not be the check of the `error.Code`.