module Charon.Backend.Default.Exception
( TrashDirFilesNotFoundE (..),
TrashDirInfoNotFoundE (..),
)
where
import Charon.Backend.Default.Utils qualified as Default.Utils
import Charon.Data.Paths
( PathI (MkPathI),
PathIndex
( TrashHome
),
)
import Charon.Prelude
newtype TrashDirFilesNotFoundE = MkTrashDirFilesNotFoundE (PathI TrashHome)
deriving stock (Int -> TrashDirFilesNotFoundE -> ShowS
[TrashDirFilesNotFoundE] -> ShowS
TrashDirFilesNotFoundE -> String
(Int -> TrashDirFilesNotFoundE -> ShowS)
-> (TrashDirFilesNotFoundE -> String)
-> ([TrashDirFilesNotFoundE] -> ShowS)
-> Show TrashDirFilesNotFoundE
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TrashDirFilesNotFoundE -> ShowS
showsPrec :: Int -> TrashDirFilesNotFoundE -> ShowS
$cshow :: TrashDirFilesNotFoundE -> String
show :: TrashDirFilesNotFoundE -> String
$cshowList :: [TrashDirFilesNotFoundE] -> ShowS
showList :: [TrashDirFilesNotFoundE] -> ShowS
Show)
instance Exception TrashDirFilesNotFoundE where
displayException :: TrashDirFilesNotFoundE -> String
displayException (MkTrashDirFilesNotFoundE (MkPathI OsPath
th)) =
[String] -> String
forall a. Monoid a => [a] -> a
mconcat
[ String
"The trash files directory was not found at '",
OsPath -> String
decodeOsToFpDisplayEx OsPath
files,
String
"' despite the trash home existing. This can be fixed by ",
String
"manually creating the directory or resetting everything (i.e. charon empty -f)."
]
where
files :: OsPath
files = OsPath
th OsPath -> OsPath -> OsPath
</> OsPath
Default.Utils.pathFiles
newtype TrashDirInfoNotFoundE = MkTrashDirInfoNotFoundE (PathI TrashHome)
deriving stock (Int -> TrashDirInfoNotFoundE -> ShowS
[TrashDirInfoNotFoundE] -> ShowS
TrashDirInfoNotFoundE -> String
(Int -> TrashDirInfoNotFoundE -> ShowS)
-> (TrashDirInfoNotFoundE -> String)
-> ([TrashDirInfoNotFoundE] -> ShowS)
-> Show TrashDirInfoNotFoundE
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TrashDirInfoNotFoundE -> ShowS
showsPrec :: Int -> TrashDirInfoNotFoundE -> ShowS
$cshow :: TrashDirInfoNotFoundE -> String
show :: TrashDirInfoNotFoundE -> String
$cshowList :: [TrashDirInfoNotFoundE] -> ShowS
showList :: [TrashDirInfoNotFoundE] -> ShowS
Show)
instance Exception TrashDirInfoNotFoundE where
displayException :: TrashDirInfoNotFoundE -> String
displayException (MkTrashDirInfoNotFoundE (MkPathI OsPath
th)) =
[String] -> String
forall a. Monoid a => [a] -> a
mconcat
[ String
"The trash info directory was not found at '",
OsPath -> String
decodeOsToFpDisplayEx OsPath
info,
String
"' despite the trash home existing. This can be fixed by ",
String
"manually creating the directory or resetting everything (i.e. charon empty -f)."
]
where
info :: OsPath
info = OsPath
th OsPath -> OsPath -> OsPath
</> OsPath
Default.Utils.pathInfo