Skip to main content

systemprompt_files/services/upload/
error.rs

1//! File-upload error types.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use thiserror::Error;
7
8use super::FileValidationError;
9
10#[derive(Debug, Error)]
11pub enum FileUploadError {
12    #[error("File persistence is disabled")]
13    PersistenceDisabled,
14
15    #[error("Validation failed: {0}")]
16    Validation(#[from] FileValidationError),
17
18    #[error("Failed to decode base64: {0}")]
19    Base64Decode(#[from] base64::DecodeError),
20
21    #[error("IO error: {0}")]
22    Io(#[from] std::io::Error),
23
24    #[error("Database error: {0}")]
25    Database(String),
26
27    #[error("Configuration error: {0}")]
28    Config(String),
29
30    #[error("Base64 input too large: encoded size {encoded_size} bytes exceeds limit")]
31    Base64TooLarge { encoded_size: usize },
32
33    #[error("Path validation failed: {0}")]
34    PathValidation(String),
35}