System.Net.WebConnection.HandleError C# (CSharp) Method

HandleError() private method

private HandleError ( WebExceptionStatus st, Exception e, string where ) : void
st WebExceptionStatus
e Exception
where string
return void
		void HandleError (WebExceptionStatus st, Exception e, string where)
		{
			status = st;
			lock (this) {
				if (st == WebExceptionStatus.RequestCanceled)
					Data = new WebConnectionData ();
			}

			if (e == null) { // At least we now where it comes from
				try {
#if TARGET_JVM
					throw new Exception ();
#else
					throw new Exception (new System.Diagnostics.StackTrace ().ToString ());
#endif
				} catch (Exception e2) {
					e = e2;
				}
			}

			HttpWebRequest req = null;
			if (Data != null && Data.request != null)
				req = Data.request;

			Close (true);
			if (req != null) {
				req.FinishedReading = true;
				req.SetResponseError (st, e, where);
			}
		}
		

Usage Example

Esempio n. 1
0
        internal static void InitRead(object state)
        {
            WebConnection cnc = (WebConnection)state;
            Stream        ns  = cnc.nstream;

            try {
                int size = cnc.buffer.Length - cnc.position;
                ns.BeginRead(cnc.buffer, cnc.position, size, readDoneDelegate, cnc);
            } catch (Exception e) {
                cnc.HandleError(WebExceptionStatus.ReceiveFailure, e, "InitRead");
            }
        }
All Usage Examples Of System.Net.WebConnection::HandleError