deason 1 年之前
父節點
當前提交
d0f04afc51
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/main/java/cn/com/qmth/examcloud/tool/utils/HttpHelper.java

+ 5 - 1
src/main/java/cn/com/qmth/examcloud/tool/utils/HttpHelper.java

@@ -60,13 +60,17 @@ public class HttpHelper {
 
         Request request = builder.build();
         try (Response response = HttpClientBuilder.getClient().newCall(request).execute();
-             ResponseBody body = response.body();) {
+                ResponseBody body = response.body();) {
             String bodyStr = body.string();
             if (response.isSuccessful()) {
                 return bodyStr;
             }
 
             log.error("{}, response code: {}, body: {}", url, response.code(), bodyStr);
+            if (response.code() == 403) {
+                throw new StatusException("禁止访问,请检查认证信息是否错误或已过期!");
+            }
+
             throw new StatusException(bodyStr);
         } catch (IOException e) {
             log.error("{}, error: {}", url, e.getMessage());