fix(storage): type not found errors (#27265)

This commit is contained in:
Shoubhit Dash
2026-05-13 12:25:04 +05:30
committed by GitHub
parent d93a06431e
commit e9a29e4908
6 changed files with 51 additions and 21 deletions
@@ -24,11 +24,14 @@ export const errorLayer = HttpRouter.middleware<{ handles: unknown }>()((effect)
const error = defect.defect
log.error("failed", { error, cause: Cause.pretty(cause) })
if (error instanceof NotFoundError) {
return Effect.succeed(HttpServerResponse.jsonUnsafe(error.toObject(), { status: 404 }))
}
if (error instanceof NamedError) {
return Effect.succeed(
HttpServerResponse.jsonUnsafe(error.toObject(), {
status: iife(() => {
if (error instanceof NotFoundError) return 404
if (error instanceof Provider.ModelNotFoundError) return 400
if (error.name === "ProviderAuthValidationFailed") return 400
if (error.name.startsWith("Worktree")) return 400