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;
}
$A.modalError({
content: error?.msg || error || '获取模型列表失败',
content: error?.msg || '获取模型列表失败',
onOk: _ => {
this.showModal = false;
},
@ -367,7 +367,7 @@ export default {
this.inputValue = '';
this.startStream(streamKey, responseEntry);
} catch (error) {
const msg = error?.msg || error || '发送失败';
const msg = error?.msg || '发送失败';
if (responseEntry) {
this.markResponseError(responseEntry, msg);
}
@ -697,7 +697,7 @@ export default {
result.then(() => {
this.closeAssistant();
}).catch(error => {
$A.modalError(error?.msg || error || '应用失败');
$A.modalError(error?.msg || '应用失败');
}).finally(() => {
response.applyLoading = false;
});
@ -707,7 +707,7 @@ export default {
}
} catch (error) {
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);
} catch (error) {
const msg = error?.msg || error?.message;
msg && console.warn(msg);
console.warn(error?.msg || error);
} finally {
this.appSortLoading = false;
this.appSortLoaded = true;

View File

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