Inheritance: System.Exception
示例#1
0
 void DoRequestCallback()
 {
     try
     {
         using (var endGetResponse = Request.EndGetResponse(responseAsyncResult))
         {
             if (Request.Method == "get" || Request.Method == "post")
             {
                 using (var responseStream = endGetResponse.GetResponseStream())
                 {
                     ReadFromResponse(responseStream);
                     return;
                 }
             }
         }
         ReadFromResponse(null);
     }
     catch (WebException webException)
     {
         if (webException.IsNotFound())
         {
             ReadFromResponse(null);
             return;
         }
         string remoteError;
         if ( webException.TryReadRemoteError(out remoteError))
         {
             var remoteException = new RemoteException(remoteError, webException);
             ExceptionCallback(remoteException);
         }
         else
         {
             ExceptionCallback(webException);
         }
     }
     catch (Exception exception)
     {
         ExceptionCallback(exception);
     }
 }
示例#2
0
 void DoRequestCallback()
 {
     try
     {
         using (var endGetResponse = Request.EndGetResponse(responseAsyncResult))
         {
             if (Request.Method == "get" || Request.Method == "post")
             {
                 using (var responseStream = endGetResponse.GetResponseStream())
                 {
                     ReadFromResponse(responseStream);
                     return;
                 }
             }
         }
         ReadFromResponse(null);
     }
     catch (WebException webException)
     {
         if (webException.IsNotFound())
         {
             ReadFromResponse(null);
             return;
         }
         string remoteError;
         if (webException.TryReadRemoteError(out remoteError))
         {
             var remoteException = new RemoteException(remoteError, webException);
             ExceptionCallback(remoteException);
         }
         else
         {
             ExceptionCallback(webException);
         }
     }
     catch (Exception exception)
     {
         ExceptionCallback(exception);
     }
 }