pub enum SseError {
NoData,
MalformedId,
MalformedName(EventNameError),
Unserialisable,
}Expand description
Why a frame could not be read or written.
The variants are what a caller can act on separately: a frame that cannot be serialised is this process’s bug, a corrupt id is the peer’s, and a block with no data is not a failure at all — the standard simply dispatches nothing for it.
Variants§
NoData
The block carried no data: field, so the standard dispatches no event.
MalformedId
An id: field was not a decimal event id.
Carries nothing from the input on purpose. The value came from a peer, it may be arbitrarily long, and a refusal that echoes it would be reflecting untrusted input into a response body for no diagnostic gain: the peer knows what it sent.
MalformedName(EventNameError)
An event: field was not a usable event name.
Carries the EventNameError because the two reasons are worth telling
apart when reading a log: an empty name is a peer that wrote
event: and nothing else, and a name holding a line terminator is a
peer — or something pretending to be one — that tried to smuggle a
second field through a frame. Neither echoes the offending value, for
the reason MalformedId does not.
Unserialisable
The value has a map key that is not a string, so it has no JSON form.
Trait Implementations§
impl Eq for SseError
Source§impl Error for SseError
impl Error for SseError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()