Skip to main content

engine/
error.rs

1use thiserror::Error;
2
3/// Result alias for the engine.
4pub type Result<T> = std::result::Result<T, EngineError>;
5
6/// A fatal error that stops the sync run. Because the engine confirms a
7/// change's source ack only after the change is durably applied, stopping on an
8/// error is safe: unconfirmed changes are redelivered when the run restarts.
9#[derive(Debug, Error)]
10#[non_exhaustive]
11pub enum EngineError {
12    /// From the source — capturing changes or resolving/assembling documents.
13    #[error(transparent)]
14    Source(#[from] sources_core::SourceError),
15
16    /// From a sink write.
17    #[error(transparent)]
18    Sink(#[from] sinks_core::SinkError),
19
20    /// From the work queue.
21    #[error(transparent)]
22    Queue(#[from] queue_core::QueueError),
23
24    /// A spawned task failed to join (panicked).
25    #[error("task failed: {0}")]
26    Task(String),
27
28    /// The sink rejected one or more documents at the item level and the
29    /// failure policy is [`Stop`](crate::FailurePolicy::Stop). Switch to
30    /// `skip` to quarantine such documents and keep the pipeline running.
31    #[error(
32        "sink rejected {0} document(s) (e.g. {1}); stopping. \
33         set on-error=skip to quarantine rejected documents and continue"
34    )]
35    DocumentsRejected(usize, String),
36}