MCPcopy Create free account
hub / github.com/PIKACHUIM/CFWorkerACME / pickMsg

Function pickMsg

frontend/src/api/request.ts:63–69  ·  view source on GitHub ↗
(d: any)

Source from the content-addressed store, hash-verified

61 // 有的用 texts / message / error,兜底才使用 axios 本身的 err.message(如 "Request failed with status code 403")
62 const data: any = err.response?.data;
63 const pickMsg = (d: any): string | undefined => {
64 if (!d) return undefined;
65 if (typeof d === 'string') return d;
66 if (typeof d !== 'object') return undefined;
67 // 优先顺序:nonce(业务错误文案) > texts > message > error > msg
68 return d.nonce || d.texts || d.message || d.error || d.msg;
69 };
70 const bizMsg = pickMsg(data);
71 const finalMsg = bizMsg || err.message || '网络异常,请稍后重试';
72

Callers 1

request.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected