Solid · API

stream.onError

Subscribes a listener to validation errors. It is called for every value the stream rejects, with the path, the expected type and the received type. The call comes as soon as the value opens (chunk 2 in the example, before the rest of the string has arrived), and because nothing is thrown, this is the only place a rejected value is reported.

Schema
z.object({
  show: z.string(),
  night: z.string(),
  seats: z.array(z.string()),
  price_cents: z.number(),
  why: z.string(),
})
Listener
stream.onError((error) => calls.push(error))
Stream, chunk by chunk
Reply so far
{"show":"The Tempest","night":"2026-10-24",
Listener calls
[]
Output matches the expected value

Runs in this page on the installed package. The input and the expected output are defined by the example.