module CabalGild.Exception.InvalidMode where

import qualified Control.Monad.Catch as Exception

-- | This exception is thrown when the given 'CabalGild.Type.Mode.Mode' is
-- invalid.
newtype InvalidMode
  = InvalidMode String
  deriving (InvalidMode -> InvalidMode -> Bool
(InvalidMode -> InvalidMode -> Bool)
-> (InvalidMode -> InvalidMode -> Bool) -> Eq InvalidMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: InvalidMode -> InvalidMode -> Bool
== :: InvalidMode -> InvalidMode -> Bool
$c/= :: InvalidMode -> InvalidMode -> Bool
/= :: InvalidMode -> InvalidMode -> Bool
Eq, Int -> InvalidMode -> ShowS
[InvalidMode] -> ShowS
InvalidMode -> String
(Int -> InvalidMode -> ShowS)
-> (InvalidMode -> String)
-> ([InvalidMode] -> ShowS)
-> Show InvalidMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> InvalidMode -> ShowS
showsPrec :: Int -> InvalidMode -> ShowS
$cshow :: InvalidMode -> String
show :: InvalidMode -> String
$cshowList :: [InvalidMode] -> ShowS
showList :: [InvalidMode] -> ShowS
Show)

instance Exception.Exception InvalidMode where
  displayException :: InvalidMode -> String
displayException (InvalidMode String
s) = String
"invalid mode: " String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
s

-- | Constructs an 'InvalidMode' from the given 'String'.
fromString :: String -> InvalidMode
fromString :: String -> InvalidMode
fromString = String -> InvalidMode
InvalidMode