mirror of
https://github.com/anomalyco/opencode.git
synced 2026-05-11 05:01:04 +00:00
fix(session): preserve tagged error messages (#18165)
This commit is contained in:
parent
a7ea93528b
commit
84e62fc662
3 changed files with 14 additions and 2 deletions
|
|
@ -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",
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue