use std::path::PathBuf;
use thiserror::Error;
pub trait ModuleStoreReadCapability {
fn read(&self, module_id: &str) -> Result<Vec<u8>, ModuleStoreError>;
}
#[derive(Error, Debug)]
pub enum ModuleStoreError {
#[error("Path validation failed for {0}: {1}")]
InvalidPath(PathBuf, String),
#[error("Error reading filesytem: {0}")]
Filesystem(String),
}
impl From<ModuleStoreError> for i32 {
fn from(value: ModuleStoreError) -> Self {
match value {
ModuleStoreError::InvalidPath(_, _) => -300,
ModuleStoreError::Filesystem(_) => -301,
}
}
}