refactor(errors): normalize user-facing error messages

This commit is contained in:
2026-07-03 13:05:46 +08:00
parent 65d972fbb4
commit 8a71041b5d
7 changed files with 72 additions and 10 deletions
+4 -1
View File
@@ -9,6 +9,7 @@
* - onError(errorMessage)
*/
import { getApiConfig } from "@/core/net/config/api_config";
import { ExceptionHandler } from "@/core/errors";
import { AppEnvUtil, Logger } from "@/utils";
const log = new Logger("ChatWebSocket");
@@ -89,7 +90,9 @@ export class ChatWebSocket {
};
} catch (e) {
logWebSocketError("✕ WS CONNECT FAILED", e);
this.onError?.(e instanceof Error ? e.message : String(e));
this.onError?.(
ExceptionHandler.message(e, "WebSocket connection failed."),
);
}
}