pub enum OutcomeError {
Arguments(String),
Answer(String),
NotAnObject(JsonObjectError),
NotLowerable(LowerError),
}Expand description
Why a generated handler could not produce an answer.
Variants§
Arguments(String)
The peer’s arguments object did not deserialise into the handler’s
argument struct.
Carries the deserialiser’s own message. A second, shorter vocabulary for “that is not the right shape” would lose the one field a caller can act on, which is which field and why.
Answer(String)
The handler’s return value could not be serialised.
A Serialize impl that fails is a bug in the handler’s types — a
non-string map key, a NaN — not a bad request, and the message says so
rather than blaming the peer.
NotAnObject(JsonObjectError)
The assembled document was not a JSON object.
Cannot happen for a value this function builds, and propagated rather than swallowed so that a future member with a different shape fails loudly instead of producing an empty result.
NotLowerable(LowerError)
A handler answered with a ToolResult
the negotiated revision cannot express.
Reached only from codec::result::verbatim, which is the path a
#[tool] takes when its return type is a ToolResult. Carries the
codec’s own error rather than a paraphrase of it: the revision, the
feature, and whether a policy named a rule for it are three different
fixes and the caller cannot pick between them without all three.
Trait Implementations§
Source§impl Clone for OutcomeError
impl Clone for OutcomeError
Source§impl Debug for OutcomeError
impl Debug for OutcomeError
Source§impl Display for OutcomeError
impl Display for OutcomeError
impl Eq for OutcomeError
Source§impl Error for OutcomeError
impl Error for OutcomeError
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()
Source§impl From<OutcomeError> for DispatchError
impl From<OutcomeError> for DispatchError
Source§fn from(error: OutcomeError) -> Self
fn from(error: OutcomeError) -> Self
A reader or getter that could not produce a document failed.
Every variant becomes DispatchError::HandlerFailed carrying the
outcome’s own message. None of them is a bad request — the peer named a
resource or a prompt that exists and sent well-formed params — so
reporting any of them as InvalidParams would send a client looking in
its own request for something it got right.