Skip to main content

TaskFailureKind

Enum TaskFailureKind 

Source
pub enum TaskFailureKind {
    Connection,
    Authentication,
    Validation,
    Timeout,
    Command,
    Unsupported,
    Internal,
    External,
}
Expand description

Categorizes the type of failure that occurred during task execution.

TaskFailureKind provides a classification system for task failures, allowing error handling logic to distinguish between different categories of errors and respond appropriately. This classification helps with error reporting, retry logic, and determining whether failures are transient or permanent.

§Variants

  • Connection - The task failed due to a connection error, such as network unreachability, connection refused, or connection dropped. These failures are often transient and may succeed on retry.

  • Authentication - The task failed due to authentication or authorization issues, such as invalid credentials, expired tokens, or insufficient permissions. These typically require credential updates or permission changes.

  • Validation - The task failed due to validation errors in input data, configuration, or parameters. This indicates that the task cannot proceed with the provided data and requires correction.

  • Timeout - The task failed because it exceeded a time limit. This could indicate slow network conditions, an overloaded target system, or an operation that takes longer than expected. Often retryable.

  • Command - The task failed during command execution on the target system, such as a command returning a non-zero exit code or producing unexpected output. This indicates the operation itself failed on the remote system.

  • Unsupported - The task failed because the requested operation is not supported by the target system, plugin, or current configuration. This typically indicates a permanent failure that won’t succeed on retry.

  • Internal - The task failed due to a Genja/framework internal error, such as a programming error, resource exhaustion, or unexpected engine state.

  • External - The task failed because a task implementation, plugin, or external dependency returned an error that Genja captured and stored as a host failure.

§Example

use genja_core::task::{TaskFailure, TaskFailureKind};
use std::io;

let connection_failure = TaskFailure::new(
    io::Error::new(io::ErrorKind::ConnectionRefused, "connection refused")
)
.with_kind(TaskFailureKind::Connection)
.with_retryable(true);

let auth_failure = TaskFailure::new(
    io::Error::new(io::ErrorKind::PermissionDenied, "invalid credentials")
)
.with_kind(TaskFailureKind::Authentication)
.with_retryable(false);

assert!(matches!(connection_failure.kind(), TaskFailureKind::Connection));
assert!(matches!(auth_failure.kind(), TaskFailureKind::Authentication));

Variants§

§

Connection

§

Authentication

§

Validation

§

Timeout

§

Command

§

Unsupported

§

Internal

§

External

Trait Implementations§

Source§

impl Clone for TaskFailureKind

Source§

fn clone(&self) -> TaskFailureKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TaskFailureKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Serialize for TaskFailureKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Serialize for T
where T: Serialize + ?Sized,

Source§

fn erased_serialize(&self, serializer: &mut dyn Serializer) -> Result<(), Error>

Source§

fn do_erased_serialize( &self, serializer: &mut dyn Serializer, ) -> Result<(), ErrorImpl>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.