refactor(tui): centralize application exit (#31524)
This commit is contained in:
parent
960eacebcf
commit
37522185d3
32 changed files with 176 additions and 1217 deletions
|
|
@ -53,7 +53,7 @@ describe("HttpApi error middleware", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
it.live("does not expose config defects from generic middleware", () =>
|
||||
it.live("returns invalid config defects as structured client errors", () =>
|
||||
Effect.gen(function* () {
|
||||
const configError = new ConfigErrorV1.InvalidError({
|
||||
path: "/tmp/opencode.json",
|
||||
|
|
@ -70,11 +70,16 @@ describe("HttpApi error middleware", () => {
|
|||
const body = yield* response.json
|
||||
const serialized = JSON.stringify(body)
|
||||
|
||||
expect(response.status).toBe(500)
|
||||
expectUnknownErrorBody(body)
|
||||
expect(serialized).not.toContain("/tmp/opencode.json")
|
||||
expect(serialized).not.toContain("provider")
|
||||
expect(serialized).not.toContain("anthropic")
|
||||
expect(response.status).toBe(400)
|
||||
expect(body).toMatchObject({
|
||||
name: "ConfigInvalidError",
|
||||
data: {
|
||||
path: "/tmp/opencode.json",
|
||||
issues: [{ message: "Expected object", path: ["provider", "anthropic", "options"] }],
|
||||
},
|
||||
})
|
||||
expect(serialized).toContain("/tmp/opencode.json")
|
||||
expect(serialized).toContain("anthropic")
|
||||
}),
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue