1pub use crate::workflow_registry::WorkflowRegistrationError;
4#[cfg(feature = "experimental")]
5use temporalio_client::PluginApplyError;
6use temporalio_sdk_core::WorkerValidationError as CoreWorkerValidationError;
7
8#[derive(Debug, thiserror::Error)]
10#[non_exhaustive]
11pub enum RuntimeError {
12 #[error("runtime initialization failed: {0}")]
14 Initialization(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
15 #[error("no Tokio runtime is active on the current thread")]
17 NoCurrentTokioRuntime,
18}
19
20impl RuntimeError {
21 pub(crate) fn from_core(error: anyhow::Error) -> Self {
22 Self::Initialization(error.into_boxed_dyn_error())
23 }
24}
25
26#[derive(Debug, thiserror::Error)]
28#[non_exhaustive]
29pub enum WorkerValidationError {
30 #[error("namespace {namespace} was not found or otherwise could not be described: {source}")]
32 NamespaceDescribeError {
33 #[source]
35 source: temporalio_client::tonic::Status,
36 namespace: String,
38 },
39}
40
41impl WorkerValidationError {
42 pub(crate) fn from_core(error: CoreWorkerValidationError) -> Self {
43 match error {
44 CoreWorkerValidationError::NamespaceDescribeError { source, namespace } => {
45 Self::NamespaceDescribeError { source, namespace }
46 }
47 }
48 }
49}
50
51#[derive(Debug, thiserror::Error)]
55#[non_exhaustive]
56pub enum WorkerCreateError {
57 #[cfg(feature = "experimental")]
59 #[error(transparent)]
60 Plugin(#[from] PluginApplyError),
61 #[error("worker initialization failed: {0}")]
63 Initialization(#[source] anyhow::Error),
64}
65
66#[derive(Debug, thiserror::Error)]
68#[non_exhaustive]
69pub enum WorkerRunError {
70 #[error("worker validation failed: {0}")]
72 Validation(#[source] WorkerValidationError),
73 #[error("{message}")]
75 Fatal {
76 message: String,
78 #[source]
80 source: Box<dyn std::error::Error + Send + Sync + 'static>,
81 },
82}
83
84pub use temporalio_common::error::{
85 ActivityExecutionError, ApplicationErrorCategory, ApplicationFailure,
86 CancelExternalWorkflowError, ChildWorkflowExecutionError, ChildWorkflowStartError,
87 OutgoingActivityError, OutgoingError, OutgoingWorkflowError, RetryState, TimeoutType,
88 WorkflowSignalError,
89};