reth_storage_errors/
lockfile.rs

1use alloc::string::{String, ToString};
2
3/// Storage lock error.
4#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
5pub enum StorageLockError {
6    /// Write lock taken
7    #[error("storage directory is currently in use as read-write by another process: PID {_0}")]
8    Taken(usize),
9    /// Indicates other unspecified errors.
10    #[error("{_0}")]
11    Other(String),
12}
13
14impl StorageLockError {
15    /// Converts any error into the `Other` variant of `StorageLockError`.
16    pub fn other<E: core::error::Error>(err: E) -> Self {
17        Self::Other(err.to_string())
18    }
19}