fix: propagate LinesCodecError in parse_sse_event (#8) #13
Reference in New Issue
Block a user
Delete Branch "fix/propagate-sse-lines-codec-error"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #8
Summary
GeminiClient::parse_sse_eventnow propagatestokio_util::codec::LinesCodecErrorasSome(Err(Error::EventSourceError(err)))instead of converting it toNonewith.ok()?.decode_eofreturns an I/O error on unparsed remaining bytes) are now surfaced to downstream callers rather than silently ending the stream as if generation completed normally.parse_sse_eventcontinues to returnNonewhen a valid event has no data (event.data: None), correctly ignoring empty keep-alive frames.Testing
parse_sse_event_propagates_lines_codec_errorverifyingLinesCodecError::Iois mapped toError::EventSourceError.parse_sse_event_returns_none_when_data_is_noneverifying keep-alive frames are skipped.stream_generate_content_yields_error_on_truncated_sseverifying that an SSE stream truncated before EOF yieldsError::EventSourceError.cargo testandcargo clippypass cleanly.