Ejemplo n.º 1
0
        private static PubgException BuildException(HttpResponseMessage response, string responseContent)
        {
            switch (response.StatusCode)
            {
            case HttpStatusCode.Unauthorized: return(new PubgUnauthorizedException());

            case HttpStatusCode.UnsupportedMediaType: return(new PubgContentTypeException());

            case HttpStatusCode.NotFound: return(new PubgNotFoundException());

            default:
                var errors = ErrorMapper.MapErrors(responseContent);
                return(new PubgException("Errors have occured with your request", response.StatusCode, errors));
            }
        }
Ejemplo n.º 2
0
        private static PubgException BuildException(HttpResponseMessage response, string responseContent)
        {
            switch (response.StatusCode)
            {
            case HttpStatusCode.Unauthorized: return(new PubgUnauthorizedException());

            case HttpStatusCode.UnsupportedMediaType: return(new PubgContentTypeException());

            case HttpStatusCode.NotFound: return(new PubgNotFoundException());

            case (HttpStatusCode)429: return(new PubgTooManyRequestsException(response.Headers.GetValues("X-RateLimit-Reset").FirstOrDefault()));

            default:
                var errors = ErrorMapper.MapErrors(responseContent);
                return(new PubgException("Errors have occured with your request", response.StatusCode, errors));
            }
        }