feat: 优化错误处理逻辑,简化错误消息输出

This commit is contained in:
kuaifan 2025-11-11 21:49:09 +08:00
parent 31c157f58f
commit bea5058df8
3 changed files with 6 additions and 7 deletions

View File

@ -228,7 +228,7 @@ export default {
return; return;
} }
$A.modalError({ $A.modalError({
content: error?.msg || error || '获取模型列表失败', content: error?.msg || '获取模型列表失败',
onOk: _ => { onOk: _ => {
this.showModal = false; this.showModal = false;
}, },
@ -367,7 +367,7 @@ export default {
this.inputValue = ''; this.inputValue = '';
this.startStream(streamKey, responseEntry); this.startStream(streamKey, responseEntry);
} catch (error) { } catch (error) {
const msg = error?.msg || error || '发送失败'; const msg = error?.msg || '发送失败';
if (responseEntry) { if (responseEntry) {
this.markResponseError(responseEntry, msg); this.markResponseError(responseEntry, msg);
} }
@ -697,7 +697,7 @@ export default {
result.then(() => { result.then(() => {
this.closeAssistant(); this.closeAssistant();
}).catch(error => { }).catch(error => {
$A.modalError(error?.msg || error || '应用失败'); $A.modalError(error?.msg || '应用失败');
}).finally(() => { }).finally(() => {
response.applyLoading = false; response.applyLoading = false;
}); });
@ -707,7 +707,7 @@ export default {
} }
} catch (error) { } catch (error) {
response.applyLoading = false; response.applyLoading = false;
$A.modalError(error?.msg || error || '应用错误'); $A.modalError(error?.msg || '应用错误');
} }
}, },

View File

@ -646,8 +646,7 @@ export default {
}); });
this.appSorts = this.normalizeSortPayload(data?.sorts); this.appSorts = this.normalizeSortPayload(data?.sorts);
} catch (error) { } catch (error) {
const msg = error?.msg || error?.message; console.warn(error?.msg || error);
msg && console.warn(msg);
} finally { } finally {
this.appSortLoading = false; this.appSortLoading = false;
this.appSortLoaded = true; this.appSortLoaded = true;

View File

@ -266,7 +266,7 @@ export default {
} catch (error) { } catch (error) {
$A.modalError({ $A.modalError({
language: false, language: false,
content: this.$L("AI开启新会话失败") + `: ${error.msg || error}`, content: this.$L("AI开启新会话失败") + `: ${error.msg || 'Unknown Error'}`,
}); });
reject(error); reject(error);
} }