#[non_exhaustive]pub enum Error {
Body {
status: StatusCode,
message: String,
},
ContentType {
found: String,
},
MissingContentType,
Decode(Error),
EmptyBody,
NotAcceptable {
accept: String,
},
}axum only.Expand description
A request this endpoint refused, before any events were produced.
Implements IntoResponse, so it doubles as the rejection type of
AgUiInput — a handler can take
Result<AgUiInput, Error> and inspect the failure, or take AgUiInput and
let axum answer with the response below.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Body
The request body could not be read at all — a connection that died
mid-body, or a payload over the configured
DefaultBodyLimit.
Carries the status axum’s own extractor chose, so a body limit stays a
413 rather than being flattened into a 400.
ContentType
The Content-Type was set to something that is not JSON.
Refused rather than sniffed. See
AgUiInput for
what requiring a JSON media type does and does not protect.
MissingContentType
The request carried no Content-Type at all.
An unlabelled body is not assumed to be JSON.
AgentEndpoint::allow_missing_content_type
accepts one, for clients that cannot be changed to send the header.
Decode(Error)
The body was JSON, but not a
RunAgentInput.
Schema failures name the field path; malformed JSON names the offset.
EmptyBody
The request body was empty.
NotAcceptable
Content negotiation found nothing this build can emit.
See negotiate.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()