Skip to content

Commit 59f44bb

Browse files
docs+test: clarify parseStandardSchema error message; send _meta in normalize test
1 parent 8568522 commit 59f44bb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/core/src/util/standardSchema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ export async function validateStandardSchema<T extends StandardSchemaV1>(
182182

183183
/**
184184
* Parses data against any Standard Schema. Async because Standard Schema's `validate` may return
185-
* a Promise. The error is wrapped as an `Error` so callers can interpolate `.message` directly.
185+
* a Promise. The error is wrapped as an `Error` whose `.message` is the formatted issues string
186+
* from {@linkcode validateStandardSchema}, so callers can interpolate it directly.
186187
*
187188
* Use this for user-supplied schemas (e.g. the 3-arg `setRequestHandler(method, paramsSchema, h)`
188189
* form). For internal SDK Zod schemas, prefer the synchronous `parseSchema` in `./schema.js`.

packages/core/test/shared/threeArgHandlers.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe('setRequestHandler — three-arg paramsSchema form', () => {
4949
seen = p;
5050
return {};
5151
});
52-
await a.request({ method: 'acme/noop' }, z.object({}));
52+
await a.request({ method: 'acme/noop', params: { _meta: { trace: 'x' } } }, z.object({}));
5353
expect(seen).toEqual({});
5454
});
5555
});

0 commit comments

Comments
 (0)