MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / handleApiError

Function handleApiError

web/src/helpers/api.js:116–135  ·  view source on GitHub ↗
(error, response = null)

Source from the content-addressed store, hash-verified

114
115// 处理API错误响应
116export const handleApiError = (error, response = null) => {
117 const errorInfo = {
118 error: error.message || '未知错误',
119 timestamp: new Date().toISOString(),
120 stack: error.stack
121 };
122
123 if (response) {
124 errorInfo.status = response.status;
125 errorInfo.statusText = response.statusText;
126 }
127
128 if (error.message.includes('HTTP error')) {
129 errorInfo.details = '服务器返回了错误状态码';
130 } else if (error.message.includes('Failed to fetch')) {
131 errorInfo.details = '网络连接失败或服务器无响应';
132 }
133
134 return errorInfo;
135};
136
137// 处理模型数据
138export const processModelsData = (data, currentModel) => {

Callers 1

useApiRequestFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected