Skip to main content

temporalio_sdk/
error.rs

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