fix: show the reason the server gave for a failed action
Every failure in the management screens printed a guess. Deleting a working copy said "it may be published, or something may reference it, or someone may have edited it first" — three maybes, while the server had answered with exactly one: "이 기록을 참조하는 곳이 있어 삭제할 수 없습니다". A version conflict read as "in use" because the same sentence covered both, and an author watching some deletions succeed and others fail had no way to tell them apart. The gateway now carries the server's client-safe message and the screens show it. The canned sentences remain only as a fallback for a failure that never reached the server. The topic status label said "사용 중" for every active topic, including one created seconds earlier that nothing references. Next to a refusal about records that use a topic, the two read as the same statement. It says "활성" now, which is what the status means. Publishing also stops demanding a finished document — the mock validator moves with the real one, so what an author sees against fixtures matches production.
This commit is contained in:
@@ -2,6 +2,7 @@ import { useEffect, useState, type FormEvent } from "react";
|
||||
|
||||
import type { ListDocumentsQuery } from "../../../application/ports/studio-gateway.ts";
|
||||
import type { DocumentPage } from "../../../contracts/studio/contract.ts";
|
||||
import { managementFailureMessage } from "../../../application/ports/management-gateway-error.ts";
|
||||
import { useStudio } from "../use-studio.ts";
|
||||
import { GuardedStudioLink } from "./guarded-studio-link.tsx";
|
||||
|
||||
@@ -98,10 +99,10 @@ export function DocumentList() {
|
||||
? { ...current, items: current.items.filter((row) => row.id !== item.id) }
|
||||
: current,
|
||||
);
|
||||
} catch {
|
||||
setDeleteError(
|
||||
"삭제하지 못했습니다. 게시 중이거나, 이 기록을 참조하는 곳이 있거나, 다른 곳에서 먼저 수정되었을 수 있습니다.",
|
||||
);
|
||||
} catch (error) {
|
||||
// 서버는 무엇이 막았는지 정확히 알고 그것을 보내 준다. 예전에는 그 문구를 버리고 추측 셋을
|
||||
// 늘어놓아, 버전 충돌도 "사용 중" 으로 읽혔다.
|
||||
setDeleteError(managementFailureMessage(error, "삭제하지 못했습니다."));
|
||||
} finally {
|
||||
setDeletingId(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user