ag_session/error.rs
1//! Errors returned by the programmatic session API.
2
3use crate::TaskChainPhase;
4
5/// Stable error returned by [`crate::SessionService`] operations.
6#[derive(Clone, Debug, Eq, PartialEq, thiserror::Error)]
7pub enum SessionError {
8 /// Persisted session data could not be converted into the public model.
9 #[error("Invalid session data: {0}")]
10 InvalidData(String),
11 /// The requested session does not exist.
12 #[error("Session not found")]
13 NotFound,
14 /// The host session workflow rejected or failed the requested operation.
15 #[error("{0}")]
16 Operation(String),
17 /// The session's latest workflow is still working in this phase, or an
18 /// earlier reply is still being decided; reply again after it finishes.
19 #[error("The task chain agent is still working; wait for it to finish before replying")]
20 TaskChainBusy(TaskChainPhase),
21 /// The session owns no workflow that could receive a reply.
22 #[error("Session has no task chain")]
23 TaskChainNotFound,
24}