@@ -0,0 +1,11 @@
|
||||
import { describeError } from "@conusai-kit/ui/data"
|
||||
import { serviceNotice } from "@conusai-kit/ui/patterns"
|
||||
import { LEDGER_ERRORS } from "../contract/index.js"
|
||||
import type { LedgerLabels } from "./labels.js"
|
||||
|
||||
/** What a form shows for a refused write: the module's drift fence, a Ledger refusal in the reader's words, or the kit's text. */
|
||||
export function ledgerFailure(error: unknown, labels: LedgerLabels): string {
|
||||
const code = (error as { problem?: { code?: unknown } } | null)?.problem?.code
|
||||
if (code === LEDGER_ERRORS.drift) return labels.drift
|
||||
return serviceNotice(error, labels.refusals)?.text ?? describeError(error)
|
||||
}
|
||||
Reference in New Issue
Block a user