260715_01_ENH: 에러 메시지에 대한 처리 수정
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@kri/common",
|
"name": "@kri/common",
|
||||||
"version": "0.17.0",
|
"version": "0.18.0",
|
||||||
"description": "KRI 프런트엔드 공통 유틸리티",
|
"description": "KRI 프런트엔드 공통 유틸리티",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
|
|||||||
@@ -16,10 +16,22 @@ export const getServerMessage = (payload: unknown): string | undefined => {
|
|||||||
return payload;
|
return payload;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof payload === "object" && payload !== null && "message" in payload) {
|
if (typeof payload === "object" && payload !== null) {
|
||||||
const message = (payload as { message?: unknown }).message;
|
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;
|
return undefined;
|
||||||
|
|||||||
Reference in New Issue
Block a user