summaryrefslogtreecommitdiff
path: root/src/SlackBuilder/Update.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/SlackBuilder/Update.hs')
-rw-r--r--src/SlackBuilder/Update.hs9
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])