1 module Core (problem, whenVerbose) where
6 import Control.Exception
8 import Control.Monad.Catch
11 newtype GargClientException = GCE String
12 instance Show GargClientException where
13 show (GCE s) = "Garg client exception: " ++ s
15 instance Exception GargClientException
17 -- | Abort with a message
18 problem :: String -> ClientM a
19 problem = throwM . GCE
21 -- | Only run the given computation when the @--verbose@ flag is
23 whenVerbose :: Monad m => ClientOpts -> m () -> m ()
24 whenVerbose opts act = when (unHelpful $ verbose opts) act