Skip to main content

temporalio_sdk/
error.rs

1//! Shared SDK error re-exports.
2
3pub use crate::workflow_registry::WorkflowRegistrationError;
4use temporalio_client::PluginApplyError;
5pub use temporalio_sdk_core::WorkerValidationError;
6
7/// Errors that can occur while creating a worker.
8///
9/// **Experimental:** This API may change or be removed.
10#[derive(Debug, thiserror::Error)]
11#[non_exhaustive]
12pub enum WorkerCreateError {
13    /// A plugin failed while configuring worker options.
14    #[error(transparent)]
15    Plugin(#[from] PluginApplyError),
16    /// Worker initialization failed after plugin configuration completed.
17    #[error("worker initialization failed: {0}")]
18    Initialization(#[source] anyhow::Error),
19}
20
21/// Errors that can occur while running a worker.
22#[derive(Debug, thiserror::Error)]
23#[non_exhaustive]
24pub enum WorkerRunError {
25    /// Worker validation failed before polling began.
26    #[error("worker validation failed: {0}")]
27    Validation(#[source] WorkerValidationError),
28    /// An unrecoverable error occurred while running the worker.
29    #[error("{message}")]
30    Fatal {
31        /// Worker operation that could not continue.
32        message: String,
33        /// Underlying cause.
34        #[source]
35        source: Box<dyn std::error::Error + Send + Sync + 'static>,
36    },
37}
38
39pub use temporalio_common::error::{
40    ActivityExecutionError, ApplicationErrorCategory, ApplicationFailure,
41    ChildWorkflowExecutionError, ChildWorkflowStartError, OutgoingActivityError, OutgoingError,
42    OutgoingWorkflowError, RetryState, TimeoutType, WorkflowSignalError,
43};