Пример #1
0
        private static void ThrowIfCURLMError(CURLMcode error)
        {
            if (error != CURLMcode.CURLM_OK)
            {
                string msg = CurlException.GetCurlErrorString((int)error, true);
                VerboseTrace(msg);
                switch (error)
                {
                case CURLMcode.CURLM_ADDED_ALREADY:
                case CURLMcode.CURLM_BAD_EASY_HANDLE:
                case CURLMcode.CURLM_BAD_HANDLE:
                case CURLMcode.CURLM_BAD_SOCKET:
                    throw new ArgumentException(msg);

                case CURLMcode.CURLM_UNKNOWN_OPTION:
                    throw new ArgumentOutOfRangeException(msg);

                case CURLMcode.CURLM_OUT_OF_MEMORY:
                    throw new OutOfMemoryException(msg);

                case CURLMcode.CURLM_INTERNAL_ERROR:
                default:
                    throw new CurlException((int)error, msg);
                }
            }
        }
Пример #2
0
        private static void ThrowIfCURLMError(CURLMcode error)
        {
            if (error != CURLMcode.CURLM_OK &&               // success
                error != CURLMcode.CURLM_CALL_MULTI_PERFORM) // success + a hint to try curl_multi_perform again
            {
                string msg = CurlException.GetCurlErrorString((int)error, isMulti: true);
                EventSourceTrace(msg);
                switch (error)
                {
                case CURLMcode.CURLM_ADDED_ALREADY:
                case CURLMcode.CURLM_BAD_EASY_HANDLE:
                case CURLMcode.CURLM_BAD_HANDLE:
                case CURLMcode.CURLM_BAD_SOCKET:
                    throw new ArgumentException(msg);

                case CURLMcode.CURLM_UNKNOWN_OPTION:
                    throw new ArgumentOutOfRangeException(msg);

                case CURLMcode.CURLM_OUT_OF_MEMORY:
                    throw new OutOfMemoryException(msg);

                case CURLMcode.CURLM_INTERNAL_ERROR:
                default:
                    throw new CurlException((int)error, msg);
                }
            }
        }
Пример #3
0
 private static void ThrowIfCURLEError(CURLcode error)
 {
     if (error != CURLcode.CURLE_OK)
     {
         var inner = new CurlException((int)error, isMulti: false);
         VerboseTrace(inner.Message);
         throw inner;
     }
 }
Пример #4
0
 private static void ThrowIfCURLEError(int error)
 {
     if (error != CURLcode.CURLE_OK)
     {
         var inner = new CurlException(error, isMulti: false);
         VerboseTrace(inner.Message);
         throw CreateHttpRequestException(inner);
     }
 }
Пример #5
0
        private static void ThrowIfCURLEError(CURLcode error)
        {
            if (error != CURLcode.CURLE_OK) // success
            {
                string msg = CurlException.GetCurlErrorString((int)error, isMulti: false);
                EventSourceTrace(msg);
                switch (error)
                {
                case CURLcode.CURLE_OPERATION_TIMEDOUT:
                    throw new OperationCanceledException(msg);

                case CURLcode.CURLE_OUT_OF_MEMORY:
                    throw new OutOfMemoryException(msg);

                default:
                    throw new CurlException((int)error, msg);
                }
            }
        }
Пример #6
0
 private static void ThrowIfCURLEError(CURLcode error)
 {
     if (error != CURLcode.CURLE_OK)
     {
         var inner = new CurlException((int)error, isMulti: false);
         VerboseTrace(inner.Message);
         throw inner;
     }
 }
Пример #7
0
 private static void ThrowIfCURLEError(int error)
 {
     if (error != CURLcode.CURLE_OK)
     {
         var inner = new CurlException(error, isMulti: false);
         VerboseTrace(inner.Message);
         throw CreateHttpRequestException(inner);
     }
 }