#[ derive( Debug ) ]
pub enum AssetError
{
SourceNotFound
{
kind : String,
name : String,
},
NotASymlink
{
kind : String,
name : String,
},
Io( std::io::Error ),
}
impl core::fmt::Display for AssetError
{
#[ inline ]
fn fmt( &self, f : &mut core::fmt::Formatter< '_ > ) -> core::fmt::Result
{
match self
{
Self::SourceNotFound { kind, name } =>
write!( f, "{kind} '{name}' not found in $PRO_CLAUDE/{kind}s/" ),
Self::NotASymlink { kind, name } =>
write!( f, "{kind} '{name}' target is not a symlink — refusing to remove (data-loss guard)" ),
Self::Io( e ) =>
write!( f, "io error: {e}" ),
}
}
}
impl core::error::Error for AssetError
{
#[ inline ]
fn source( &self ) -> Option< &( dyn core::error::Error + 'static ) >
{
match self
{
Self::Io( e ) => Some( e ),
_ => None,
}
}
}
impl From< std::io::Error > for AssetError
{
#[ inline ]
fn from( e : std::io::Error ) -> Self
{
Self::Io( e )
}
}
#[ derive( Debug ) ]
pub enum AssetPathsError
{
EnvVarNotSet,
}
impl core::fmt::Display for AssetPathsError
{
#[ inline ]
fn fmt( &self, f : &mut core::fmt::Formatter< '_ > ) -> core::fmt::Result
{
match self
{
Self::EnvVarNotSet => write!(
f,
"environment variable $PRO_CLAUDE is not set \
— run: export PRO_CLAUDE=/path/to/your/claude-assets"
),
}
}
}
impl core::error::Error for AssetPathsError {}