• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# HttpStatusCode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中HttpStatusCode的典型用法代码示例。如果您正苦于以下问题:C# HttpStatusCode类的具体用法?C# HttpStatusCode怎么用?C# HttpStatusCode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HttpStatusCode类属于命名空间,在下文中一共展示了HttpStatusCode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: MockClientHttpResponse

 /// <summary>
 /// Creates a new instance of <see cref="MockClientHttpResponse"/>.
 /// </summary>
 /// <param name="body">The body of the response as a stream.</param>
 /// <param name="headers">The response headers.</param>
 /// <param name="statusCode">The response status code.</param>
 /// <param name="statusDescription">The response status description.</param>
 public MockClientHttpResponse(Stream body, HttpHeaders headers, HttpStatusCode statusCode, string statusDescription)
 {
     this.body = body;
     this.headers = headers;
     this.statusCode = statusCode;
     this.statusDescription = statusDescription;
 }
开发者ID:gabrielgreen,项目名称:spring-net-rest,代码行数:14,代码来源:MockClientHttpResponse.cs


示例2: UnmarshallException

 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("InternalErrorException"))
     {
         return new InternalErrorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException"))
     {
         return new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("NotAuthorizedException"))
     {
         return new NotAuthorizedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
     {
         return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyRequestsException"))
     {
         return new TooManyRequestsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonCognitoIdentityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:paveltimofeev,项目名称:aws-sdk-unity,代码行数:32,代码来源:ListIdentitiesResponseUnmarshaller.cs


示例3: UnmarshallException

       public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
       {
         ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);                    
         
         if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
         {
           return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("MissingParameterValueException"))
         {
           return new MissingParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceUnavailableException"))
         {
           return new ServiceUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValueException"))
         {
           return new InvalidParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         return new AmazonGlacierException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
       }
开发者ID:rossmas,项目名称:aws-sdk-net,代码行数:26,代码来源:DeleteArchiveResponseUnmarshaller.cs


示例4: UnmarshallException

        public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterValue"))
            {
                return new InvalidParameterValueException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterCombination"))
            {
                return new InvalidParameterCombinationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidCacheParameterGroupState"))
            {
                return new InvalidCacheParameterGroupStateException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("CacheParameterGroupNotFound"))
            {
                return new CacheParameterGroupNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            return new AmazonElastiCacheException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
        }
开发者ID:pbutlerm,项目名称:dataservices-sdk-dotnet,代码行数:26,代码来源:DeleteCacheParameterGroupResponseUnmarshaller.cs


示例5: ReplyError

 private void ReplyError(HttpStatusCode statusCode, string text, HttpResponse response)
 {
     response.StatusCode = (int)statusCode;
     response.ContentType = "text/html";
     response.Write(String.Format("<html><title>MovieInfo : ERROR</title><body><p>{0}</p></body></html>", text));
     for (int i = 0; i < 85; ++i) response.Write("&nbsp;");
 }
开发者ID:sandrapatfer,项目名称:PROMPT11-07-ConcurrentProgramming.sandrapatfer,代码行数:7,代码来源:MovieInfoTPL2Handler.cs


示例6: UnmarshallException

 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException"))
     {
         return new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InternalException"))
     {
         return new InternalException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInputException"))
     {
         return new InvalidInputException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchEntityException"))
     {
         return new NoSuchEntityException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("OperationInProgressException"))
     {
         return new OperationInProgressException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonInspectorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:borik,项目名称:aws-sdk-net,代码行数:32,代码来源:DeleteApplicationResponseUnmarshaller.cs


示例7: LinkedINHttpResponseException

 /// <summary>
 /// Constructs an <see cref="LinkedINHttpResponseException"/>.
 /// </summary>
 /// <param name="expectedStatusCode">The expected <see cref="HttpStatusCode"/> of the response.</param>
 /// <param name="actualStatusCode">The actual <see cref="HttpStatusCode"/> of the response.</param>
 /// <param name="message">The message descriving the cause of this exception.</param>
 /// <param name="inner">The inner <see cref="Exception"/>.</param>
 public LinkedINHttpResponseException( HttpStatusCode expectedStatusCode, HttpStatusCode actualStatusCode, string message, Exception inner )
     : base(message, inner)
 {
     // set values
     ExpectedStatusCode = expectedStatusCode;
     ActualStatusCode = actualStatusCode;
 }
开发者ID:Gloor,项目名称:lma,代码行数:14,代码来源:LinkedINHttpResponseException.cs


示例8: UnmarshallException

 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException"))
     {
         return new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("LimitExceededException"))
     {
         return new LimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("OperationAbortedException"))
     {
         return new OperationAbortedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceAlreadyExistsException"))
     {
         return new ResourceAlreadyExistsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceUnavailableException"))
     {
         return new ServiceUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonCloudWatchLogsException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:wmatveyenko,项目名称:aws-sdk-net,代码行数:25,代码来源:CreateLogGroupResponseUnmarshaller.cs


示例9: UnmarshallException

        public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);

            if (errorResponse.Code != null && errorResponse.Code.Equals("ListenerNotFound"))
            {
                return new ListenerNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("CertificateNotFound"))
            {
                return new CertificateNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("LoadBalancerNotFound"))
            {
                return new LoadBalancerNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidConfigurationRequest"))
            {
                return new InvalidConfigurationRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
            }

            return new AmazonElasticLoadBalancingException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
        }
开发者ID:nburn42,项目名称:aws-sdk-for-net,代码行数:26,代码来源:SetLoadBalancerListenerSSLCertificateResponseUnmarshaller.cs


示例10: UnmarshallException

        public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
        {
            ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);

              if (errorResponse.Code != null && errorResponse.Code.Equals("ProvisionedThroughputExceededException"))
              {
            return new ProvisionedThroughputExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
              }

              if (errorResponse.Code != null && errorResponse.Code.Equals("ConditionalCheckFailedException"))
              {
            return new ConditionalCheckFailedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
              }

              if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServerErrorException"))
              {
            return new InternalServerErrorException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
              }

              if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
              {
            return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
              }

              return new AmazonDynamoDBException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
        }
开发者ID:TarantulaTechnology,项目名称:aws,代码行数:26,代码来源:PutItemResponseUnmarshaller.cs


示例11: ApplyCoupon

		/// <summary> 
		/// Applies a defined coupon to the cart specified in the request.
		/// <example> 
		///  <code> 
		/// var result = AppliedDiscountFactory.ApplyCoupon(handler : handler,  cartId :  cartId,  couponCode :  couponCode,  responseFields :  responseFields,  expectedCode: expectedCode, successCode: successCode); 
		/// var optionalCasting = ConvertClass<Cart/>(result); 
		/// return optionalCasting;
		///  </code> 
		/// </example> 
		/// </summary>
		public static Mozu.Api.Contracts.CommerceRuntime.Carts.Cart ApplyCoupon(ServiceClientMessageHandler handler, 
 		 string cartId, string couponCode, string responseFields = null, 
		 HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
		{
			SetSdKparameters();
			var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
			var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
			Debug.WriteLine(currentMethodName  + '.' + currentMethodName );
			var apiClient = Mozu.Api.Clients.Commerce.Carts.AppliedDiscountClient.ApplyCouponClient(
				 cartId :  cartId,  couponCode :  couponCode,  responseFields :  responseFields		);
			try
			{
				apiClient.WithContext(handler.ApiContext).Execute();
			}
			catch (ApiException ex)
			{
				// Custom error handling for test cases can be placed here
				Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
				if (customException != null)
					throw customException;
				return null;
			}
			return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode) 
					 ? (apiClient.Result()) 
					 : null;

		}
开发者ID:eileenzhuang1,项目名称:mozu-dotnet,代码行数:37,代码来源:AppliedDiscountCartsFactory.cs


示例12: UnmarshallException

       public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
       {
         ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);                    
         
         if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
         {
           return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException"))
         {
           return new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("InternalServiceException"))
         {
           return new InternalServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("ValidationException"))
         {
           return new ValidationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         if (errorResponse.Code != null && errorResponse.Code.Equals("IncompatibleVersionException"))
         {
           return new IncompatibleVersionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
         }
 
         return new AmazonElasticTranscoderException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
       }
开发者ID:rsparkyc,项目名称:aws-sdk-net,代码行数:31,代码来源:ReadPipelineResponseUnmarshaller.cs


示例13: UnmarshallException

 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("ClientException"))
     {
         return new ClientException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("DirectoryLimitExceededException"))
     {
         return new DirectoryLimitExceededException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidParameterException"))
     {
         return new InvalidParameterException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceException"))
     {
         return new ServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("UnsupportedOperationException"))
     {
         return new UnsupportedOperationException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonDirectoryServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:rajdotnet,项目名称:aws-sdk-net,代码行数:32,代码来源:CreateMicrosoftADResponseUnmarshaller.cs


示例14: GetWebStatusCodeString

        /*++

            GetWebStatusCodeString - Get a StatusCode-specific resource string

            This method is used to map a HTTP status code to a specific user
            readable error code.

            Input:

                statusCode      - Id for resource string.
                Status          - The WebExceptionStatus to be formatted.

            Returns:

                string for localized message.

        --*/
        public static string GetWebStatusCodeString(HttpStatusCode statusCode, string statusDescription) {
            string webStatusCode = "(" + ((int)statusCode).ToString(NumberFormatInfo.InvariantInfo) + ")";
            string statusMessage = null;
            //
            // Now combine the label with the base enum key and look up the status msg.
            //
            try {
                //
                // convert the HttpStatusCode to its label and look it up.
                //
                statusMessage = SR.GetString("net_httpstatuscode_" + statusCode.ToString(), null);
            }
            catch {
            }

            if (statusMessage!=null && statusMessage.Length>0) {
                webStatusCode += " " + statusMessage;
            }
            else {
                //
                // Otherwise try to map the base status.
                //
                if (statusDescription!=null && statusDescription.Length>0) {
                    webStatusCode += " " + statusDescription;
                }
            }

            return webStatusCode;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:46,代码来源:_NetRes.cs


示例15: UnmarshallException

 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentDoesNotExistException"))
     {
         return new DeploymentDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("DeploymentIdRequiredException"))
     {
         return new DeploymentIdRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InstanceDoesNotExistException"))
     {
         return new InstanceDoesNotExistException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InstanceIdRequiredException"))
     {
         return new InstanceIdRequiredException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidDeploymentIdException"))
     {
         return new InvalidDeploymentIdException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInstanceNameException"))
     {
         return new InvalidInstanceNameException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonCodeDeployException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:36,代码来源:GetDeploymentInstanceResponseUnmarshaller.cs


示例16: CheckStatusCodeIs

        public Step CheckStatusCodeIs(HttpStatusCode codeToMatch)
        {
            SetUpDefaultHeaders();
            Stopwatch stopWatch = Stopwatch.StartNew();
            var task = Get();
            string htmlContent = task.Result.Content.ReadAsStringAsync().Result;
            stopWatch.Stop();
            Console.WriteLine("Took {0} Milliseconds", stopWatch.ElapsedMilliseconds);
            if (!string.IsNullOrWhiteSpace(htmlContent))
            {
                if (htmlContent.Contains("__EVENTVALIDATION"))
                {
                    CurrentEventValidation = HttpScraper.GetEventValidationFromHtml(htmlContent);
                }

                if (htmlContent.Contains("__VIEWSTATE"))
                {
                    CurrentViewState = HttpScraper.GetViewStateFromHtml(htmlContent);
                }

                task.Result.StatusCode.Should().Be(codeToMatch);
            }
            else
            {
                throw new Exception("Status code was null");
            }
            Step.CurrentEventValidation = CurrentEventValidation;
            Step.CurrentViewState = CurrentViewState;
            Step.CurrentHtml = htmlContent;

            Dispose();
            return Step;
        }
开发者ID:TomPallister,项目名称:PerformanceDsl,代码行数:33,代码来源:GetRequest.cs


示例17: UnmarshallException

 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDeniedException"))
     {
         return new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("AccountSetupInProgressException"))
     {
         return new AccountSetupInProgressException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidInputException"))
     {
         return new InvalidInputException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("NotFoundException"))
     {
         return new NotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("OperationFailureException"))
     {
         return new OperationFailureException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceException"))
     {
         return new ServiceException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthenticatedException"))
     {
         return new UnauthenticatedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonLightsailException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:40,代码来源:UpdateDomainEntryResponseUnmarshaller.cs


示例18: GetDocumentType

        /// <summary> 
        /// 
        /// <example> 
        ///  <code> 
        /// var result = DocumentTypeFactory.GetDocumentType(handler : handler,  documentTypeName :  documentTypeName,  dataViewMode: dataViewMode,  expectedCode: expectedCode, successCode: successCode); 
        /// var optionalCasting = ConvertClass<DocumentType/>(result); 
        /// return optionalCasting;
        ///  </code> 
        /// </example> 
        /// </summary>
        public static Mozu.Api.Contracts.Content.DocumentType GetDocumentType(ServiceClientMessageHandler handler, 
 		 string documentTypeName,  DataViewMode dataViewMode= DataViewMode.Live, 
		 HttpStatusCode expectedCode = HttpStatusCode.OK, HttpStatusCode successCode = HttpStatusCode.OK)
        {
            SetSdKparameters();
            var currentClassName = System.Reflection.MethodInfo.GetCurrentMethod().DeclaringType.Name;
            var currentMethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
            Debug.WriteLine(currentMethodName  + '.' + currentMethodName );
            var apiClient = Mozu.Api.Clients.Content.DocumentTypeClient.GetDocumentTypeClient(
                 documentTypeName :  documentTypeName, dataViewMode: dataViewMode		);
            try
            {
                apiClient.WithContext(handler.ApiContext).Execute();
            }
            catch (ApiException ex)
            {
                // Custom error handling for test cases can be placed here
                Exception customException = TestFailException.GetCustomTestException(ex, currentClassName, currentMethodName, expectedCode);
                if (customException != null)
                    throw customException;
                return null;
            }
            return ResponseMessageFactory.CheckResponseCodes(apiClient.HttpResponse.StatusCode, expectedCode, successCode)
                     ? (apiClient.Result())
                     : null;
        }
开发者ID:warwickit,项目名称:MozuFreestyle,代码行数:36,代码来源:DocumentTypeFactory.cs


示例19: UnmarshallException

 /// <summary>
 /// Unmarshaller error response to exception.
 /// </summary>  
 /// <param name="context"></param>
 /// <param name="innerException"></param>
 /// <param name="statusCode"></param>
 /// <returns></returns>
 public override AmazonServiceException UnmarshallException(JsonUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = JsonErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("InternalFailureException"))
     {
         return new InternalFailureException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidRequestException"))
     {
         return new InvalidRequestException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ResourceNotFoundException"))
     {
         return new ResourceNotFoundException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ServiceUnavailableException"))
     {
         return new ServiceUnavailableException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("ThrottlingException"))
     {
         return new ThrottlingException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("UnauthorizedException"))
     {
         return new UnauthorizedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonIoTException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:aws,项目名称:aws-sdk-net,代码行数:36,代码来源:DeleteThingTypeResponseUnmarshaller.cs


示例20: UnmarshallException

 public override AmazonServiceException UnmarshallException(XmlUnmarshallerContext context, Exception innerException, HttpStatusCode statusCode)
 {
     ErrorResponse errorResponse = ErrorResponseUnmarshaller.GetInstance().Unmarshall(context);
     if (errorResponse.Code != null && errorResponse.Code.Equals("AccessDenied"))
     {
         return new AccessDeniedException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("BatchTooLarge"))
     {
         return new BatchTooLargeException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InconsistentQuantities"))
     {
         return new InconsistentQuantitiesException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("InvalidArgument"))
     {
         return new InvalidArgumentException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("MissingBody"))
     {
         return new MissingBodyException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("NoSuchDistribution"))
     {
         return new NoSuchDistributionException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     if (errorResponse.Code != null && errorResponse.Code.Equals("TooManyInvalidationsInProgress"))
     {
         return new TooManyInvalidationsInProgressException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
     }
     return new AmazonCloudFrontException(errorResponse.Message, innerException, errorResponse.Type, errorResponse.Code, errorResponse.RequestId, statusCode);
 }
开发者ID:wmatveyenko,项目名称:aws-sdk-net,代码行

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HttpTransportBindingElement类代码示例发布时间:2022-05-24
下一篇:
C# HttpServerResponse类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap