fix(provider): type model not found errors (#27334)
This commit is contained in:
@@ -64,6 +64,23 @@ describe("cli.error", () => {
|
||||
expect(formatted).toContain("Check your network, proxy, or VPN configuration and try again.")
|
||||
})
|
||||
|
||||
test("formats legacy and tagged provider model errors the same way", () => {
|
||||
const data = {
|
||||
providerID: "anthropic",
|
||||
modelID: "claude-sonet-4",
|
||||
suggestions: ["claude-sonnet-4"],
|
||||
}
|
||||
const expected = [
|
||||
"Model not found: anthropic/claude-sonet-4",
|
||||
"Did you mean: claude-sonnet-4",
|
||||
"Try: `opencode models` to list available models",
|
||||
"Or check your config (opencode.json) provider/model names",
|
||||
].join("\n")
|
||||
|
||||
expect(FormatError({ name: "ProviderModelNotFoundError", data })).toBe(expected)
|
||||
expect(FormatError({ _tag: "ProviderModelNotFoundError", ...data })).toBe(expected)
|
||||
})
|
||||
|
||||
test("formats cancelled UI errors as empty output", () => {
|
||||
expect(FormatError(new UI.CancelledError())).toBe("")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user