diff --git a/Learn.Archives.Core/Common/OhException.cs b/Learn.Archives.Core/Common/OhException.cs
index 72eca5c..fb36166 100644
--- a/Learn.Archives.Core/Common/OhException.cs
+++ b/Learn.Archives.Core/Common/OhException.cs
@@ -22,6 +22,16 @@ namespace Learn.Archives.Core.Common
throw new OhException(message, code);
}
///
+ /// 抛出 异常
+ ///
+ ///
+ ///
+ ///
+ public static T Error(string message, int code = 500)
+ {
+ throw new OhException(message, code);
+ }
+ ///
/// 抛出 模型校验异常
///
///
diff --git a/Learn.Archives.Core/Common/UserCenterService.cs b/Learn.Archives.Core/Common/UserCenterService.cs
index b4f32b1..530c17b 100644
--- a/Learn.Archives.Core/Common/UserCenterService.cs
+++ b/Learn.Archives.Core/Common/UserCenterService.cs
@@ -71,8 +71,19 @@ namespace Learn.Archives.Core.Common
requestMessage.Content = new StringContent(data.ToJson(), Encoding.UTF8, "application/json");
var responseMessage = await httpClient.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead);
- var resStr = await responseMessage.Content?.ReadAsStringAsync();
- var res = JsonSerializer.Deserialize>(resStr);
+ var resStr = string.Empty;
+ try
+ {
+ resStr= await responseMessage?.Content?.ReadAsStringAsync();
+
+ }
+ catch (Exception ex)
+ {
+ return Oh.Error($"请求用户中心出现异常 {resStr} {ex.Message}");
+ }
+ if(string.IsNullOrEmpty(resStr))
+ return Oh.Error($"请求用户中心出现异常 返回了空数据");
+ var res = JsonSerializer.Deserialize>(resStr);
if (res == null || res.Code != 200)
Oh.Error(res.Message, res.Code);
return res.Data;
diff --git a/Learn.Archives.Core/Learn.Archives.Core.csproj b/Learn.Archives.Core/Learn.Archives.Core.csproj
index d41fa79..91ba3a1 100644
--- a/Learn.Archives.Core/Learn.Archives.Core.csproj
+++ b/Learn.Archives.Core/Learn.Archives.Core.csproj
@@ -28,6 +28,6 @@
-
+