Delete named schema error wrapper (#27066)
This commit is contained in:
@@ -2,8 +2,8 @@ import { describe, expect, test } from "bun:test"
|
||||
import { Schema } from "effect"
|
||||
import { NamedError } from "@opencode-ai/core/util/error"
|
||||
import { errorData, errorFormat, errorMessage } from "../../src/util/error"
|
||||
import { namedSchemaError } from "../../src/util/named-schema-error"
|
||||
import { UI } from "../../src/cli/ui"
|
||||
import { MessageError } from "../../src/session/message-error"
|
||||
|
||||
describe("util.error", () => {
|
||||
test("formats native Error instances", () => {
|
||||
@@ -53,12 +53,11 @@ describe("util.error", () => {
|
||||
expect(String(data.formatted)).toContain("ResolveMessage")
|
||||
})
|
||||
|
||||
test("named schema errors are real NamedError instances", () => {
|
||||
const ExampleError = namedSchemaError("ExampleError", { message: Schema.String })
|
||||
const error = new ExampleError({ message: "boom" })
|
||||
test("schema-backed named errors are real NamedError instances", () => {
|
||||
const error = new MessageError.AuthError({ providerID: "anthropic", message: "boom" })
|
||||
|
||||
expect(error).toBeInstanceOf(NamedError)
|
||||
expect(error.toObject()).toEqual({ name: "ExampleError", data: { message: "boom" } })
|
||||
expect(error.toObject()).toEqual({ name: "ProviderAuthError", data: { providerID: "anthropic", message: "boom" } })
|
||||
})
|
||||
|
||||
test("void named errors accept JSON without data", () => {
|
||||
|
||||
Reference in New Issue
Block a user