mirror of
https://gitee.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient.Wechat.git
synced 2026-02-11 18:26:20 +08:00
feat: 独立的请求超时异常类型
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Ads.Exceptions
|
||||
{
|
||||
public class WechatAdsRequestTimeoutException : WechatAdsException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatAdsRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatAdsRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatAdsRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -89,6 +89,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatAdsRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatAdsException(ex.Message, ex);
|
||||
@@ -119,6 +123,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Ads
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatAdsRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatAdsException(ex.Message, ex);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Api.Exceptions
|
||||
{
|
||||
public class WechatApiRequestTimeoutException : WechatApiException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatApiRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatApiRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatApiRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -78,6 +78,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatApiRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatApiException(ex.Message, ex);
|
||||
@@ -108,6 +112,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Api
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatApiRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatApiException(ex.Message, ex);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.OpenAI.Exceptions
|
||||
{
|
||||
public class WechatOpenAIRequestTimeoutException : WechatOpenAIException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatOpenAIRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatOpenAIRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatOpenAIRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -116,6 +116,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatOpenAIRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatOpenAIException(ex.Message, ex);
|
||||
@@ -149,6 +153,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
.SendUrlEncodedAsync(flurlRequest.Verb, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatOpenAIRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatOpenAIException(ex.Message, ex);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -95,6 +95,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatOpenAIRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatOpenAIException(ex.Message, ex);
|
||||
@@ -125,6 +129,10 @@ namespace SKIT.FlurlHttpClient.Wechat.OpenAI
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatOpenAIRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatOpenAIException(ex.Message, ex);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness.Exceptions
|
||||
{
|
||||
public class WechatTenpayBusinessRequestTimeoutException : WechatTenpayBusinessException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayBusinessRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayBusinessRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayBusinessRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
@@ -110,6 +110,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatTenpayBusinessRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatTenpayBusinessException(ex.Message, ex);
|
||||
@@ -140,6 +144,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayBusiness
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatTenpayBusinessRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatTenpayBusinessException(ex.Message, ex);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV2.Exceptions
|
||||
{
|
||||
public class WechatTenpayRequestTimeoutException : WechatTenpayException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,6 +136,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatTenpayRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatTenpayException(ex.Message, ex);
|
||||
@@ -176,6 +180,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV2
|
||||
return await WrapResponseWithXmlAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatTenpayRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatTenpayException(ex.Message, ex);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.TenpayV3.Exceptions
|
||||
{
|
||||
public class WechatTenpayRequestTimeoutException : WechatTenpayException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatTenpayRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
@@ -117,6 +117,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatTenpayRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatTenpayException(ex.Message, ex);
|
||||
@@ -147,6 +151,10 @@ namespace SKIT.FlurlHttpClient.Wechat.TenpayV3
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatTenpayRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatTenpayException(ex.Message, ex);
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work.Exceptions
|
||||
{
|
||||
public class WechatWorkRequestTimeoutException : WechatWorkException
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
internal WechatWorkRequestTimeoutException()
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatWorkRequestTimeoutException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal WechatWorkRequestTimeoutException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -79,6 +79,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
using IFlurlResponse flurlResponse = await base.SendRequestAsync(flurlRequest, httpContent, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatWorkRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatWorkException(ex.Message, ex);
|
||||
@@ -109,6 +113,10 @@ namespace SKIT.FlurlHttpClient.Wechat.Work
|
||||
await base.SendRequestWithJsonAsync(flurlRequest, data, cancellationToken);
|
||||
return await WrapResponseWithJsonAsync<T>(flurlResponse, cancellationToken);
|
||||
}
|
||||
catch (FlurlHttpTimeoutException ex)
|
||||
{
|
||||
throw new Exceptions.WechatWorkRequestTimeoutException(ex.Message, ex);
|
||||
}
|
||||
catch (FlurlHttpException ex)
|
||||
{
|
||||
throw new WechatWorkException(ex.Message, ex);
|
||||
|
||||
Reference in New Issue
Block a user