diff --git a/Octokit/Http/Connection.cs b/Octokit/Http/Connection.cs index f3e5214961..db5e58faba 100644 --- a/Octokit/Http/Connection.cs +++ b/Octokit/Http/Connection.cs @@ -281,6 +281,7 @@ async Task> RunRequest(IRequest request) { { HttpStatusCode.Unauthorized, GetExceptionForUnauthorized }, { HttpStatusCode.Forbidden, GetExceptionForForbidden }, + { HttpStatusCode.NotFound, response => new NotFoundException(response) }, { (HttpStatusCode)422, response => new ApiValidationException(response) } }; @@ -293,11 +294,6 @@ static void HandleErrors(IResponse response) throw exceptionFunc(response); } - if ((int)response.StatusCode == 404) - { - throw new NotFoundException(response); - } - if ((int)response.StatusCode >= 400) { throw new ApiException(response);