260715_01_ENH: 에러 메시지에 대한 처리 수정

This commit is contained in:
2026-07-15 16:29:01 +09:00
parent 9bbab13c29
commit 33c5924582
2 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@kri/common",
"version": "0.17.0",
"version": "0.18.0",
"description": "KRI 프런트엔드 공통 유틸리티",
"type": "module",
"main": "./dist/index.js",

View File

@@ -16,10 +16,22 @@ export const getServerMessage = (payload: unknown): string | undefined => {
return payload;
}
if (typeof payload === "object" && payload !== null && "message" in payload) {
const message = (payload as { message?: unknown }).message;
if (typeof payload === "object" && payload !== null) {
const { detail, message, errMessage } = payload as {
detail?: unknown;
message?: unknown;
errMessage?: unknown;
};
return typeof message === "string" ? message : undefined;
if (typeof detail === "string") {
return detail;
}
if (typeof message === "string") {
return message;
}
return typeof errMessage === "string" ? errMessage : undefined;
}
return undefined;