Closed quadgod closed 4 months ago
@quadgod there's no built-in error for streaming because once you write to the stream the HTTP response code and HTTP headers are already sent to the client. You cannot change them anymore, and cannot change what body will be sent (or not sent).
For something like SSE it's best to use a combination of a custom error message the client can parse, and if the error is related to being unable to send data to the client then have the service log or submit metrics so you can investigate.
Hi everybody. Is this possible to add error return for
Body: func(ctx huma.Context) error {
? During streaming might happens everything, and it would be better to have way to return error and properly handle it.Or it would be better to add
ctx huma.Context
instead func handler(ctx context.Context
, input *MyInput)?Thanks!