fix(session): preserve tagged error messages (#18165)

This commit is contained in:
Kit Langton
2026-03-18 20:36:53 -04:00
committed by GitHub
parent a7ea93528b
commit 84e62fc662
3 changed files with 14 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ import { MessageV2 } from "../../src/session/message-v2"
import type { Provider } from "../../src/provider/provider"
import { ModelID, ProviderID } from "../../src/provider/schema"
import { SessionID, MessageID, PartID } from "../../src/session/schema"
import { Question } from "../../src/question"
const sessionID = SessionID.make("session")
const providerID = ProviderID.make("test")
@@ -915,4 +916,15 @@ describe("session.message-v2.fromError", () => {
},
})
})
test("serializes tagged errors with their message", () => {
const result = MessageV2.fromError(new Question.RejectedError(), { providerID })
expect(result).toStrictEqual({
name: "UnknownError",
data: {
message: "The user dismissed this question",
},
})
})
})