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