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§
Trait Implementations§
Source§impl Clone for TaskFailureKind
impl Clone for TaskFailureKind
Source§fn clone(&self) -> TaskFailureKind
fn clone(&self) -> TaskFailureKind
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more