From 62569f5a20510dad64109ef18ba64929b8fecef6 Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 03 四月 2026 12:38:31 +0800
Subject: [PATCH] #

---
 rsf-design/src/utils/http/error.js |   25 +++++++++++++++++++++----
 1 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/rsf-design/src/utils/http/error.js b/rsf-design/src/utils/http/error.js
index 5220c17..499538f 100644
--- a/rsf-design/src/utils/http/error.js
+++ b/rsf-design/src/utils/http/error.js
@@ -36,14 +36,28 @@
   }
   return $t(errorMap[status] || 'httpMsg.internalServerError')
 }
+function isRequestCancelled(error) {
+  const message = String(error?.message || '').toLowerCase()
+  return (
+    error?.code === 'ERR_CANCELED' ||
+    error?.name === 'CanceledError' ||
+    error?.name === 'AbortError' ||
+    message.includes('canceled') ||
+    message.includes('cancelled') ||
+    message.includes('aborted') ||
+    message.includes('璇锋眰宸插彇娑�')
+  )
+}
 function handleError(error) {
-  if (error.code === 'ERR_CANCELED') {
-    console.warn('Request cancelled:', error.message)
-    throw new HttpError($t('httpMsg.requestCancelled'), ApiStatus.error)
+  const requestConfig = error.config
+  if (isRequestCancelled(error)) {
+    throw new HttpError($t('httpMsg.requestCancelled'), 'REQUEST_CANCELLED', {
+      url: requestConfig?.url,
+      method: requestConfig?.method?.toUpperCase()
+    })
   }
   const statusCode = error.response?.status
   const errorMessage = error.response?.data?.msg || error.message
-  const requestConfig = error.config
   if (!error.response) {
     throw new HttpError($t('httpMsg.networkError'), ApiStatus.error, {
       url: requestConfig?.url,
@@ -60,6 +74,9 @@
   })
 }
 function showError(error, showMessage = true) {
+  if (error.code === 'REQUEST_CANCELLED') {
+    return
+  }
   if (showMessage) {
     ElMessage.error(error.message)
   }

--
Gitblit v1.9.1