🔨 优化异常处理逻辑.

This commit is contained in:
lijiahangmax
2025-12-01 09:59:48 +08:00
parent 0ece84bdf1
commit c6b248ab6f
26 changed files with 21 additions and 46 deletions

View File

@@ -58,15 +58,13 @@
// 修改配置
appStore.updateSettings({ [key]: value });
// 同步偏好
try {
await updatePreference({
type: 'SYSTEM',
item: key,
value
});
} catch (e) {
}
await updatePreference({
type: 'SYSTEM',
item: key,
value
});
};
</script>
<style lang="less" scoped>

View File

@@ -48,7 +48,6 @@
setLoading(true);
try {
treeData.value = await cacheStore.loadHostGroupTree();
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -163,7 +163,6 @@
}
}
}
} catch (e) {
} finally {
emits('setLoading', false);
}
@@ -300,7 +299,6 @@
});
// 移动分组
moveNode(treeData.value, dragNode, dropNode, dropPosition);
} catch (e) {
} finally {
emits('setLoading', false);
}
@@ -312,7 +310,6 @@
emits('setLoading', true);
const groups = await cacheStore.loadHostGroupTree(force);
treeData.value = groups || [];
} catch (e) {
} finally {
emits('setLoading', false);
}

View File

@@ -75,7 +75,6 @@
username: s.username,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -57,7 +57,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -160,7 +160,6 @@
hosts.value = data;
// 设置主机搜索选项
filterOptions.value = getAuthorizedHostOptions(data.hostList);
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -62,7 +62,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -67,7 +67,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -284,6 +284,7 @@ export default class LogAppender implements ILogAppender {
this.client.close();
}
} catch (e) {
// ignored
}
}

View File

@@ -139,7 +139,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -66,7 +66,6 @@
setVisible(false);
Message.error('cron 表达式错误');
}
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -125,7 +125,6 @@
Message.success('回滚成功');
emits('updated');
handleClear();
} catch (e) {
} finally {
setLoading(false);
}
@@ -144,7 +143,6 @@
pagination.total = data.total;
pagination.current = request.page;
pagination.pageSize = request.limit;
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -126,7 +126,6 @@
}
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -43,7 +43,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -48,7 +48,6 @@
value: s.agentKey,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -37,7 +37,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -70,7 +70,6 @@
origin: s
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -78,7 +78,6 @@
title: '根目录',
children: render([...menus])
}];
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -96,10 +96,16 @@
const reloadAllMessage = async () => {
hasMore.value = true;
messageList.value = [];
// 查询数量
queryMessageCount();
// 加载列表
await loadMessage();
try {
await Promise.all([
// 查询数量
queryMessageCount(),
// 加载列表
loadMessage()
]);
} catch (e) {
console.error('load message error', e);
}
};
// 获取数量
@@ -108,7 +114,6 @@
try {
const { data } = await getSystemMessageCount(queryUnread.value);
classifyCount.value = data;
} catch (ex) {
} finally {
setFetchLoading(false);
}
@@ -135,17 +140,16 @@
limit: messageLimit,
classify: currentClassify.value,
queryUnread: queryUnread.value,
maxId,
maxId
});
data.forEach(s => {
messageList.value.push({
...s,
content: clearHtmlTag(s.content),
contentHtml: replaceHtmlTag(s.content),
contentHtml: replaceHtmlTag(s.content)
});
});
hasMore.value = data.length === messageLimit;
} catch (ex) {
} finally {
setFetchLoading(false);
}
@@ -159,7 +163,6 @@
await updateSystemMessageReadAll(currentClassify.value);
// 修改状态
messageList.value.forEach(s => s.status = MessageStatus.READ);
} catch (ex) {
} finally {
setMessageLoading(false);
}
@@ -171,7 +174,6 @@
try {
// 清理消息
await clearSystemMessage(currentClassify.value);
} catch (ex) {
} finally {
setMessageLoading(false);
}
@@ -204,7 +206,6 @@
// 移除
const index = messageList.value.findIndex(s => s.id === message.id);
messageList.value.splice(index, 1);
} catch (ex) {
} finally {
setMessageLoading(false);
}
@@ -237,7 +238,7 @@
onUnmounted(() => {
localStorage.setItem(MESSAGE_CONFIG_KEY, JSON.stringify({
currentClassify: currentClassify.value,
queryUnread: queryUnread.value,
queryUnread: queryUnread.value
}));
});

View File

@@ -45,7 +45,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -94,7 +94,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -94,7 +94,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -65,7 +65,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -64,7 +64,6 @@
value: s.id,
};
});
} catch (e) {
} finally {
setLoading(false);
}

View File

@@ -127,8 +127,6 @@
// 清空
handlerClear();
emits('updated');
} catch (e) {
return false;
} finally {
setLoading(false);
}

View File

@@ -180,6 +180,7 @@ export default class TerminalSessionManager implements ITerminalSessionManager {
// 移除 resize 事件
removeEventListen(window, 'resize', this.dispatchFitFn);
} catch (e) {
// ignored
}
}