#[non_exhaustive]pub enum StructError {
InvalidPath {
path: String,
},
InvalidSubpath {
path: String,
},
BodyExpected {
path: String,
},
BodyUnexpected {
path: String,
},
Decode {
path: String,
source: Error,
},
Arguments {
path: String,
message: String,
},
Execution {
path: String,
message: String,
},
}Expand description
Errors produced while handling struct-backed endpoints.
Non-exhaustive: match with a wildcard arm, or use StructError::code to
map any error onto its protocol ErrorCode.
There is no Serialize variant. structio’s writers cannot fail — a
structio::json::Write impl returns () — so encoding a response is
infallible and the only failures left are about the request: a path that
does not resolve, a body that should or should not be there, a body that
does not parse, and a handler that reported its own failure.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidPath
InvalidSubpath
BodyExpected
BodyUnexpected
Decode
The request body did not parse as the endpoint’s type.
source is structio::Error, a Copy code-and-offset pair rather
than an allocated message, and it carries the offending key when the
reader knew one.
Arguments
The body of a multi-argument method call was the wrong shape — the wrong number of positional arguments, or neither an array nor an object.
Distinct from Decode, which is one argument
failing to parse as its own type. This one is about the envelope, and it
carries a message of repe’s own because no parser produced it.
Execution
Implementations§
Trait Implementations§
Source§impl Debug for StructError
impl Debug for StructError
Source§impl Display for StructError
impl Display for StructError
Source§impl Error for StructError
impl Error for StructError
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()