소스 검색

TypeError: Cannot read property 'includes' of undefined

lifanagju_citu 1 년 전
부모
커밋
3f85a9f038
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      sheep/request/index.js

+ 2 - 2
sheep/request/index.js

@@ -194,9 +194,9 @@ http.interceptors.response.use(
 					errorMessage = 'HTTP 版本不受支持';
 					break;
 			}
-			if (error.errMsg.includes('timeout')) errorMessage = '请求超时';
+			if (error?.errMsg?.includes('timeout')) errorMessage = '请求超时';
 			// #ifdef H5
-			if (error.errMsg.includes('Network'))
+			if (error?.errMsg?.includes('Network'))
 				errorMessage = window.navigator.onLine ? '服务器异常' : '请检查您的网络连接';
 			// #endif
 		}