refactor(monitor): ♻️ 优化代码

This commit is contained in:
tsl
2026-04-01 10:05:53 +08:00
parent 0b2c1ca83f
commit cc30c088c4
13 changed files with 156 additions and 108 deletions
+5
View File
@@ -1,5 +1,10 @@
import dayjs from "dayjs";
/** 从 unknown 类型的 catch 错误中提取可读的错误信息 */
export function getErrorMessage(e: unknown): string {
return e instanceof Error ? e.message : String(e);
}
/** 将 Date 对象格式化为 'YYYY-MM-DD HH:mm:ss' 字符串 */
export function formatTime(date: Date): string {
return dayjs(date).format("YYYY-MM-DD HH:mm:ss");