pub use crate::workflow_registry::WorkflowRegistrationError;
#[cfg(feature = "experimental")]
use temporalio_client::PluginApplyError;
use temporalio_sdk_core::WorkerValidationError as CoreWorkerValidationError;
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum RuntimeError {
#[error("runtime initialization failed: {0}")]
Initialization(#[source] Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("no Tokio runtime is active on the current thread")]
NoCurrentTokioRuntime,
}
impl RuntimeError {
pub(crate) fn from_core(error: anyhow::Error) -> Self {
Self::Initialization(error.into_boxed_dyn_error())
}
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum WorkerValidationError {
#[error("namespace {namespace} was not found or otherwise could not be described: {source}")]
NamespaceDescribeError {
#[source]
source: temporalio_client::tonic::Status,
namespace: String,
},
}
impl WorkerValidationError {
pub(crate) fn from_core(error: CoreWorkerValidationError) -> Self {
match error {
CoreWorkerValidationError::NamespaceDescribeError { source, namespace } => {
Self::NamespaceDescribeError { source, namespace }
}
}
}
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum WorkerCreateError {
#[cfg(feature = "experimental")]
#[error(transparent)]
Plugin(#[from] PluginApplyError),
#[error("worker initialization failed: {0}")]
Initialization(#[source] anyhow::Error),
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum WorkerRunError {
#[error("worker validation failed: {0}")]
Validation(#[source] WorkerValidationError),
#[error("{message}")]
Fatal {
message: String,
#[source]
source: Box<dyn std::error::Error + Send + Sync + 'static>,
},
}
pub use temporalio_common::error::{
ActivityExecutionError, ApplicationErrorCategory, ApplicationFailure,
CancelExternalWorkflowError, ChildWorkflowExecutionError, ChildWorkflowStartError,
OutgoingActivityError, OutgoingError, OutgoingWorkflowError, RetryState, TimeoutType,
WorkflowSignalError,
};