feat(errors): add centralized exception handling

This commit is contained in:
2026-07-03 12:55:45 +08:00
parent e852fb62e9
commit 65d972fbb4
20 changed files with 492 additions and 70 deletions
+2 -2
View File
@@ -1,5 +1,6 @@
import { fromCallback, fromPromise } from "xstate";
import { ExceptionHandler } from "@/core/errors";
import { MessageQueue } from "@/core/net/message-queue";
import type { ChatSendResponse } from "@/data/dto/chat";
import { getChatRepository } from "@/data/repositories/chat_repository";
@@ -131,8 +132,7 @@ function createMessageQueueActor(
const output = await sendMessageViaHttp(content);
sendBack({ type: "ChatQueuedHttpDone", output });
} catch (error) {
const errorMessage =
error instanceof Error ? error.message : "Message send failed";
const errorMessage = ExceptionHandler.message(error);
log.error("[chat-machine] message queue send failed", {
error,
});