1 parent 7417c86 commit a263433Copy full SHA for a263433
1 file changed
packages/opencode/src/util/fn.ts
@@ -2,7 +2,14 @@ import { z } from "zod"
2
3
export function fn<T extends z.ZodType, Result>(schema: T, cb: (input: z.infer<T>) => Result) {
4
const result = (input: z.infer<T>) => {
5
- const parsed = schema.parse(input)
+ let parsed
6
+ try {
7
+ parsed = schema.parse(input)
8
+ } catch (e) {
9
+ console.trace("schema validation failure stack trace:")
10
+ throw e
11
+ }
12
+
13
return cb(parsed)
14
}
15
result.force = (input: z.infer<T>) => cb(input)
0 commit comments