스킬 정리 및 리팩토링
This commit is contained in:
@@ -2,6 +2,7 @@ import { createHash } from "node:crypto";
|
||||
import { clearKisApprovalKeyCache } from "@/lib/kis/approval";
|
||||
import type { KisConfig, KisCredentialInput } from "@/lib/kis/config";
|
||||
import { getKisConfig } from "@/lib/kis/config";
|
||||
import { buildKisErrorDetail } from "@/lib/kis/error-codes";
|
||||
|
||||
/**
|
||||
* @file lib/kis/token.ts
|
||||
@@ -218,9 +219,11 @@ function buildTokenIssueBody(config: KisConfig) {
|
||||
* @see issueKisToken 토큰 발급 실패 에러 메시지 구성
|
||||
*/
|
||||
function buildTokenIssueDetail(payload: KisTokenResponse) {
|
||||
return [payload.msg1, payload.error_description, payload.error, payload.msg_cd]
|
||||
.filter(Boolean)
|
||||
.join(" / ");
|
||||
return buildKisErrorDetail({
|
||||
message: payload.msg1,
|
||||
msgCode: payload.msg_cd,
|
||||
extraMessages: [payload.error_description, payload.error],
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,7 +324,10 @@ export async function revokeKisAccessToken(credentials?: KisCredentialInput) {
|
||||
const isSuccessCode = code === "" || code === "200";
|
||||
|
||||
if (!response.ok || !isSuccessCode) {
|
||||
const detail = [payload.message, payload.msg1].filter(Boolean).join(" / ");
|
||||
const detail = buildKisErrorDetail({
|
||||
message: payload.message,
|
||||
extraMessages: [payload.msg1],
|
||||
});
|
||||
|
||||
throw new Error(
|
||||
detail
|
||||
|
||||
Reference in New Issue
Block a user