feat(errors): add centralized exception handling
This commit is contained in:
@@ -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,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user