We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3cd4769 commit e8140cdCopy full SHA for e8140cd
NewLife.Core/Remoting/ApiHelper.cs
@@ -261,7 +261,13 @@ public static HttpContent BuildContent(IPacket data)
261
}
262
if (msg.IsNullOrEmpty()) msg = response.ReasonPhrase;
263
if (msg.IsNullOrEmpty()) msg = response.StatusCode + "";
264
- throw new ApiException((Int32)response.StatusCode, msg);
+ //throw new ApiException((Int32)response.StatusCode, msg);
265
+ // Http异常响应状态,不应该抛出ApiException异常,因为后者会被认为是业务异常
266
+#if NET5_0_OR_GREATER
267
+ throw new HttpRequestException(msg, null, response.StatusCode);
268
+#else
269
+ throw new HttpRequestException(msg);
270
+#endif
271
272
if (buf == null || buf.Length == 0) return default;
273
0 commit comments