261006_03_ENH: CTI 응답 ErrMsg 포함 시 오류 알림 추가
This commit is contained in:
@@ -509,13 +509,15 @@ const saveCallHistory = (parsed: Record<string, unknown>, phase: "start" | "clos
|
||||
};
|
||||
|
||||
// 외주 문서에 오류 명세가 없어, 처리하지 않는 오류는 상태를 건드리지 않고 알리기만 한다.
|
||||
// 오류는 ZCommand 자체(예: MakeCallError)로 오거나, 요청과 같은 ZCommand에 ErrMsg를 담아 오기도 한다.
|
||||
// 재연결 루프 등으로 같은 오류가 반복될 수 있어 ZCommand별로 일정 간격 안의 중복 alert는 생략한다.
|
||||
const alertUnhandledError = (zCommand: string) => {
|
||||
const alertUnhandledError = (zCommand: string, errMsg: string) => {
|
||||
const now = Date.now();
|
||||
const lastAt = lastErrorAlertAt.get(zCommand);
|
||||
if (lastAt !== undefined && now - lastAt < CTI_ERROR_ALERT_THROTTLE_MS) return;
|
||||
lastErrorAlertAt.set(zCommand, now);
|
||||
alert(`${zCommand} 오류가 발생했습니다. 관리자에게 문의하세요.`);
|
||||
const detail = errMsg ? `\n(${errMsg})` : "";
|
||||
alert(`${zCommand} 오류가 발생했습니다. 관리자에게 문의하세요.${detail}`);
|
||||
};
|
||||
|
||||
// WS 서버 -> 클라이언트로 오는 메시지는 ZCommand가 기준값이다.
|
||||
@@ -601,8 +603,11 @@ const handleIncomingMessage = (raw: unknown) => {
|
||||
}
|
||||
default:
|
||||
console.warn("[CTI][TEMP_LOG] unhandled message ->", parsed.ZCommand, parsed); // TEMP_CTI_LOG
|
||||
if (typeof parsed.ZCommand === "string" && parsed.ZCommand.includes("Error")) {
|
||||
alertUnhandledError(parsed.ZCommand);
|
||||
if (typeof parsed.ZCommand === "string") {
|
||||
const errMsg = typeof parsed.ErrMsg === "string" ? parsed.ErrMsg.trim() : "";
|
||||
if (parsed.ZCommand.includes("Error") || errMsg) {
|
||||
alertUnhandledError(parsed.ZCommand, errMsg);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user