pub struct ExternalFailure { /* private fields */ }Expand description
An application-declared failure from an authoritative external operation.
Use this narrow escape hatch when a command delegates to another executable
and must preserve that executable’s exact nonzero status and stderr payload.
Returning ordinary handler or hook errors continues to use Standout’s normal
runtime status (1); this type does not configure general error mapping.
ExternalFailure can flow through a handler’s existing HandlerResult
error seam via ?/Into<anyhow::Error>. For pre-dispatch, wrap it with
HookError::pre_dispatch_external.
Implementations§
Source§impl ExternalFailure
impl ExternalFailure
Sourcepub fn new(
status: u8,
diagnostic: impl Into<String>,
) -> Result<Self, InvalidExternalStatus>
pub fn new( status: u8, diagnostic: impl Into<String>, ) -> Result<Self, InvalidExternalStatus>
Declares an external failure with an exact nonzero process status and verbatim stderr payload.
Sourcepub const fn exit_status(&self) -> ExitStatus
pub const fn exit_status(&self) -> ExitStatus
Returns the exact status declared by the application.
Sourcepub fn diagnostic(&self) -> &str
pub fn diagnostic(&self) -> &str
Returns the stderr payload without adding or removing any text.
Sourcepub fn with_source<E>(self, source: E) -> Self
pub fn with_source<E>(self, source: E) -> Self
Attaches the error that caused the external operation to fail.
Trait Implementations§
Source§impl Clone for ExternalFailure
impl Clone for ExternalFailure
Source§fn clone(&self) -> ExternalFailure
fn clone(&self) -> ExternalFailure
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ExternalFailure
impl Debug for ExternalFailure
Source§impl Display for ExternalFailure
impl Display for ExternalFailure
Source§impl Error for ExternalFailure
impl Error for ExternalFailure
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()