refactor(errors): migrate decisions to {code,msg}

This commit is contained in:
zetaloop
2026-02-28 07:21:51 +08:00
parent 4e2ee5be54
commit cc24a0cbc3
23 changed files with 157 additions and 165 deletions
+3 -3
View File
@@ -150,7 +150,7 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin
const file = event.target.files?.[0]
if (!file) return
const result = sendImageMessage(session.id, URL.createObjectURL(file))
if (result && !result.ok) notifyInfo(result.message ?? "发送失败")
if (!result.ok) notifyInfo(result.error.msg)
event.target.value = ""
}}
/>
@@ -162,8 +162,8 @@ export default function ChatDetailPage({ params }: { params: Promise<{ id: strin
if (!text) return
const result = sendTextMessage(session.id, text)
if (result && !result.ok) {
notifyInfo(result.message ?? "发送失败")
if (!result.ok) {
notifyInfo(result.error.msg)
return
}
setInput("")