Skip to main content

bamboo_engine/session_app/
errors.rs

1//! Error types for session use cases.
2
3/// Errors that can occur when loading a session.
4#[derive(Debug, thiserror::Error)]
5pub enum SessionLoadError {
6    #[error("session not found: {0}")]
7    NotFound(String),
8    #[error("storage error: {0}")]
9    StorageError(String),
10}
11
12/// Errors that can occur when saving a session.
13#[derive(Debug, thiserror::Error)]
14pub enum SessionSaveError {
15    #[error("storage error: {0}")]
16    StorageError(String),
17}
18
19/// Errors from the chat use case.
20#[derive(Debug, thiserror::Error)]
21pub enum ChatError {
22    #[error("session load failed: {0}")]
23    LoadFailed(#[from] SessionLoadError),
24    #[error("session save failed: {0}")]
25    SaveFailed(#[from] SessionSaveError),
26    #[error("invalid model: {0}")]
27    InvalidModel(String),
28    #[error("invalid workflow selection: {0}")]
29    InvalidWorkflowSelection(String),
30}
31
32/// Errors from the execute preparation use case.
33#[derive(Debug, thiserror::Error)]
34pub enum ExecutePreparationError {
35    #[error("session not found: {0}")]
36    NotFound(String),
37    #[error("session load failed: {0}")]
38    LoadFailed(#[from] SessionLoadError),
39    #[error("session save failed: {0}")]
40    SaveFailed(#[from] SessionSaveError),
41    #[error("invalid model: model is required")]
42    ModelRequired,
43    #[error("invalid image fallback configuration: {0}")]
44    ImageFallbackError(String),
45}
46
47/// Errors from the respond use case.
48#[derive(Debug, thiserror::Error)]
49pub enum RespondError {
50    #[error("session not found: {0}")]
51    NotFound(String),
52    #[error("session load failed: {0}")]
53    LoadFailed(#[from] SessionLoadError),
54    #[error("session save failed: {0}")]
55    SaveFailed(#[from] SessionSaveError),
56    #[error("no pending question waiting for response")]
57    NoPendingQuestion,
58    #[error("invalid response: {0}")]
59    InvalidResponse(String),
60}