Skip to main content

reinhardt_utils/storage/
errors.rs

1//! Storage error types
2
3use thiserror::Error;
4
5/// Errors that can occur during storage operations.
6#[derive(Error, Debug)]
7pub enum StorageError {
8	/// The requested file was not found in storage.
9	#[error("File not found: {0}")]
10	NotFound(String),
11
12	/// An underlying I/O error occurred.
13	#[error("IO error: {0}")]
14	Io(#[from] std::io::Error),
15
16	/// The provided path is invalid or unsafe.
17	#[error("Invalid path: {0}")]
18	InvalidPath(String),
19
20	/// The storage backend has no remaining capacity.
21	#[error("Storage full")]
22	StorageFull,
23
24	/// The operation was denied due to insufficient permissions.
25	#[error("Permission denied: {0}")]
26	PermissionDenied(String),
27
28	/// A file with the given name already exists.
29	#[error("File already exists: {0}")]
30	AlreadyExists(String),
31}
32
33/// A convenience type alias for `Result<T, StorageError>`.
34pub type StorageResult<T> = Result<T, StorageError>;