pub struct AgentError { /* private fields */ }Expand description
The plugin’s error type.
Build one with AgentError::new or the From impls for the usual
failure sources. Inspect it with AgentError::kind and
AgentError::status_code.
Implementations§
Source§impl AgentError
impl AgentError
Sourcepub fn new(kind: ErrorKind, message: impl Into<String>) -> Self
pub fn new(kind: ErrorKind, message: impl Into<String>) -> Self
Build an error from a kind and a message.
Sourcepub fn with_source<E>(
kind: ErrorKind,
message: impl Into<String>,
source: E,
) -> Self
pub fn with_source<E>( kind: ErrorKind, message: impl Into<String>, source: E, ) -> Self
Build an error that keeps the underlying cause for Error::source.
Sourcepub const fn status_code(&self) -> StatusCode
pub const fn status_code(&self) -> StatusCode
Return the HTTP status an app should answer with.
Sourcepub fn into_autumn_error(self) -> AutumnError
pub fn into_autumn_error(self) -> AutumnError
Translate the agent failure into a framework error.
Kinds that describe the app’s own misconfiguration or tool code map
to 500 helpers; upstream provider failures map to 502/503/429 through
AutumnError::with_status.
This is a method rather than a From impl because Autumn ships a
blanket From<E: Error> for AutumnError that would conflict.
Trait Implementations§
Source§impl Debug for AgentError
impl Debug for AgentError
Source§impl Display for AgentError
impl Display for AgentError
Source§impl Error for AgentError
impl Error for AgentError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Error> for AgentError
impl From<Error> for AgentError
Auto Trait Implementations§
impl !RefUnwindSafe for AgentError
impl !UnwindSafe for AgentError
impl Forget for AgentError
impl Freeze for AgentError
impl Send for AgentError
impl Sync for AgentError
impl Unpin for AgentError
impl UnsafeUnpin for AgentError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> Scoped for T
impl<T> Scoped for T
Source§fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
fn scope(ctx: &PolicyContext) -> ScopeQuery<'_, Self>
Open a deferred
ScopeQuery for this type. Resolves the
registered scope at .load() time, not here.Source§impl<T> ValidateIp for Twhere
T: ToString,
impl<T> ValidateIp for Twhere
T: ToString,
Source§fn validate_ipv4(&self) -> bool
fn validate_ipv4(&self) -> bool
Validates whether the given string is an IP V4
Source§fn validate_ipv6(&self) -> bool
fn validate_ipv6(&self) -> bool
Validates whether the given string is an IP V6
Source§fn validate_ip(&self) -> bool
fn validate_ip(&self) -> bool
Validates whether the given string is an IP