コード例 #1
0
 public override Exception CreateApiException(ApiFormat format, string content, IResponse response)
 {
     try
     {
         var errors = GetSerializer(format).Deserialize <Feed.Errors>(content);
         return(ApiException.Factory(errors, response));
     }
     catch (Exception firstAttemptEx)
     {
         try
         {
             var errors = GetSerializer(format).Deserialize <Feed.ErrorsWithoutNS>(content);
             return(ApiException.Factory(errors, response));
         }
         catch (Exception secondAttempEx)
         {
             var exceptionList = new Exception[] { firstAttemptEx, secondAttempEx };
             var aggrEx        = new AggregateException("Unable to parse error response >" + content + "<", exceptionList);
             throw aggrEx;
         }
     }
 }