module CabalGild.Unstable.Exception.SpecifiedOutputWithCheckMode where

import qualified CabalGild.Unstable.Type.Flag as Flag
import qualified Control.Monad.Catch as Exception

-- | This exception is thrown when the user specifies the output while using
-- the check mode. In other words, when @--mode=check@ and @--output=anything@.
data SpecifiedOutputWithCheckMode
  = SpecifiedOutputWithCheckMode
  deriving (SpecifiedOutputWithCheckMode
-> SpecifiedOutputWithCheckMode -> Bool
(SpecifiedOutputWithCheckMode
 -> SpecifiedOutputWithCheckMode -> Bool)
-> (SpecifiedOutputWithCheckMode
    -> SpecifiedOutputWithCheckMode -> Bool)
-> Eq SpecifiedOutputWithCheckMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SpecifiedOutputWithCheckMode
-> SpecifiedOutputWithCheckMode -> Bool
== :: SpecifiedOutputWithCheckMode
-> SpecifiedOutputWithCheckMode -> Bool
$c/= :: SpecifiedOutputWithCheckMode
-> SpecifiedOutputWithCheckMode -> Bool
/= :: SpecifiedOutputWithCheckMode
-> SpecifiedOutputWithCheckMode -> Bool
Eq, Int -> SpecifiedOutputWithCheckMode -> ShowS
[SpecifiedOutputWithCheckMode] -> ShowS
SpecifiedOutputWithCheckMode -> String
(Int -> SpecifiedOutputWithCheckMode -> ShowS)
-> (SpecifiedOutputWithCheckMode -> String)
-> ([SpecifiedOutputWithCheckMode] -> ShowS)
-> Show SpecifiedOutputWithCheckMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SpecifiedOutputWithCheckMode -> ShowS
showsPrec :: Int -> SpecifiedOutputWithCheckMode -> ShowS
$cshow :: SpecifiedOutputWithCheckMode -> String
show :: SpecifiedOutputWithCheckMode -> String
$cshowList :: [SpecifiedOutputWithCheckMode] -> ShowS
showList :: [SpecifiedOutputWithCheckMode] -> ShowS
Show)

instance Exception.Exception SpecifiedOutputWithCheckMode where
  displayException :: SpecifiedOutputWithCheckMode -> String
displayException =
    String -> SpecifiedOutputWithCheckMode -> String
forall a b. a -> b -> a
const (String -> SpecifiedOutputWithCheckMode -> String)
-> String -> SpecifiedOutputWithCheckMode -> String
forall a b. (a -> b) -> a -> b
$
      String
"cannot use --"
        String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
Flag.outputOption
        String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" when --"
        String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
Flag.modeOption
        String -> ShowS
forall a. Semigroup a => a -> a -> a
<> String
" is check"