module PathSize.Exception
( PathE (..),
)
where
import Control.DeepSeq (NFData)
import Control.Exception (Exception (displayException))
import Effects.FileSystem.OsPath (OsPath, decodeLenient)
import GHC.Generics (Generic)
data PathE = MkPathE !OsPath !String
deriving stock
(
PathE -> PathE -> Bool
(PathE -> PathE -> Bool) -> (PathE -> PathE -> Bool) -> Eq PathE
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PathE -> PathE -> Bool
== :: PathE -> PathE -> Bool
$c/= :: PathE -> PathE -> Bool
/= :: PathE -> PathE -> Bool
Eq,
(forall x. PathE -> Rep PathE x)
-> (forall x. Rep PathE x -> PathE) -> Generic PathE
forall x. Rep PathE x -> PathE
forall x. PathE -> Rep PathE x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. PathE -> Rep PathE x
from :: forall x. PathE -> Rep PathE x
$cto :: forall x. Rep PathE x -> PathE
to :: forall x. Rep PathE x -> PathE
Generic,
Eq PathE
Eq PathE =>
(PathE -> PathE -> Ordering)
-> (PathE -> PathE -> Bool)
-> (PathE -> PathE -> Bool)
-> (PathE -> PathE -> Bool)
-> (PathE -> PathE -> Bool)
-> (PathE -> PathE -> PathE)
-> (PathE -> PathE -> PathE)
-> Ord PathE
PathE -> PathE -> Bool
PathE -> PathE -> Ordering
PathE -> PathE -> PathE
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: PathE -> PathE -> Ordering
compare :: PathE -> PathE -> Ordering
$c< :: PathE -> PathE -> Bool
< :: PathE -> PathE -> Bool
$c<= :: PathE -> PathE -> Bool
<= :: PathE -> PathE -> Bool
$c> :: PathE -> PathE -> Bool
> :: PathE -> PathE -> Bool
$c>= :: PathE -> PathE -> Bool
>= :: PathE -> PathE -> Bool
$cmax :: PathE -> PathE -> PathE
max :: PathE -> PathE -> PathE
$cmin :: PathE -> PathE -> PathE
min :: PathE -> PathE -> PathE
Ord,
Int -> PathE -> ShowS
[PathE] -> ShowS
PathE -> String
(Int -> PathE -> ShowS)
-> (PathE -> String) -> ([PathE] -> ShowS) -> Show PathE
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> PathE -> ShowS
showsPrec :: Int -> PathE -> ShowS
$cshow :: PathE -> String
show :: PathE -> String
$cshowList :: [PathE] -> ShowS
showList :: [PathE] -> ShowS
Show
)
deriving anyclass
(
PathE -> ()
(PathE -> ()) -> NFData PathE
forall a. (a -> ()) -> NFData a
$crnf :: PathE -> ()
rnf :: PathE -> ()
NFData
)
instance Exception PathE where
displayException :: PathE -> String
displayException (MkPathE OsPath
p String
e) =
[String] -> String
forall a. Monoid a => [a] -> a
mconcat
[ String
"Error for path '",
OsPath -> String
decodeLenient OsPath
p,
String
"': ",
String
e
]