mirror of
https://github.com/zoriya/typebox.git
synced 2026-05-06 21:25:37 +00:00
Revision 0.26.0
This commit is contained in:
@@ -81,7 +81,7 @@ import { TRPCError } from '@trpc/server'
|
||||
export function RpcType<T extends TSchema>(schema: T) {
|
||||
return (value: unknown) => {
|
||||
if (Value.Check(schema, value)) return value
|
||||
const { path, message } = check.Errors(value).First()!
|
||||
const { path, message } = Value.Errors(schema, value).First()!
|
||||
throw new TRPCError({ message: `${message} for ${path}`, code: 'BAD_REQUEST' })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user