Exemple #1
0
 public UnprocessableEntityException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
     if ((int)response.StatusCode != 422)
     {
         throw new ArgumentException("Response must be a 422");
     }
 }
 public static GitHubErrorException From(HttpWebResponse response, GitHubErrorResponse errorResponse)
 {
     var code = (int) response.StatusCode;
     switch (code)
     {
         case 401: return new UnauthorizedException(response, errorResponse);
         case 403: return new ForbiddenException(response, errorResponse);
         case 404: return new NotFoundException(response, errorResponse);
         case 422: return new UnprocessableEntityException(response, errorResponse);
         case 500: return new ServerErrorException(response, errorResponse);
         default :
             throw new NotSupportedException("GitHub Error Response Status " + code);
     }
 }
        public static GitHubErrorException From(HttpWebResponse response, GitHubErrorResponse errorResponse)
        {
            var code = (int)response.StatusCode;

            switch (code)
            {
            case 401: return(new UnauthorizedException(response, errorResponse));

            case 403: return(new ForbiddenException(response, errorResponse));

            case 404: return(new NotFoundException(response, errorResponse));

            case 422: return(new UnprocessableEntityException(response, errorResponse));

            case 500: return(new ServerErrorException(response, errorResponse));

            default:
                throw new NotSupportedException("GitHub Error Response Status " + code);
            }
        }
Exemple #4
0
 public UnauthorizedException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
 protected GitHubErrorException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(errorResponse.Message)
 {
     Response = response;
     ErrorResponse = errorResponse;
 }
 public UnauthorizedException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
Exemple #7
0
 public ForbiddenException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
 protected GitHubErrorException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(errorResponse.Message)
 {
     Response      = response;
     ErrorResponse = errorResponse;
 }
 public ForbiddenException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
 public UnprocessableEntityException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
     if ((int) response.StatusCode != 422)
         throw new ArgumentException("Response must be a 422");
 }
 public ServerErrorException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
 public NotFoundException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
 public NotFoundException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }
 public ServerErrorException(HttpWebResponse response, GitHubErrorResponse errorResponse)
     : base(response, errorResponse)
 {
 }