diff options
| author | Eugen Wissner <belka@caraus.de> | 2024-09-14 11:32:34 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2024-09-14 11:32:34 +0200 |
| commit | 5b4caa8ff75ab50b673e5d5b9ae37eb73fb21c2a (patch) | |
| tree | a7942f83dfc00793e06a1843819a853b47dacff2 /src/SlackBuilder | |
| parent | 3dde41e0d4848567e4a7fbcd20f43d35ce8e2dbf (diff) | |
| download | slackbuilder-5b4caa8ff75ab50b673e5d5b9ae37eb73fb21c2a.tar.gz | |
Generalize handleException
Diffstat (limited to 'src/SlackBuilder')
| -rw-r--r-- | src/SlackBuilder/Update.hs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/SlackBuilder/Update.hs b/src/SlackBuilder/Update.hs index 0c7ce6f..003afb7 100644 --- a/src/SlackBuilder/Update.hs +++ b/src/SlackBuilder/Update.hs @@ -7,10 +7,13 @@ module SlackBuilder.Update , cloneFromGit , downloadWithTemplate , getAndLogLatest + , handleException , reuploadWithTemplate , updatePackageIfRequired ) where +import Control.Exception (Exception(..), SomeException(..)) +import Control.Monad.Catch (MonadCatch(..)) import Control.Monad.IO.Class (MonadIO(..)) import Control.Monad.Trans.Reader (asks) import qualified Data.ByteString as ByteString @@ -254,3 +257,9 @@ findCategory packageName = do . (currentDirectory </>) in filterM directoryFilter accumulatedDirectories >>= traverse (go currentDirectory found) <&> concat + +handleException :: (MonadIO m, MonadCatch m) => SomeException -> m () +handleException slackBuilderException + = liftIO (setSGR [SetColor Foreground Dull Red]) + >> liftIO (putStrLn (displayException slackBuilderException)) + >> liftIO (setSGR [Reset]) |
