export const replaceSensitiveText = (text: string) => { // 1. http link text = text.replace(/(?<=https?:\/\/)[^\s]+/g, 'xxx'); // 2. nx-xxx 全部替换成xxx text = text.replace(/ns-[\w-]+/g, 'xxx'); return text; }; export const getErrText = (err: any, def = '') => { const msg: string = typeof err === 'string' ? err : err?.message ?? def; msg && console.log('error =>', msg); return replaceSensitiveText(msg); };