diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-12 14:14:20 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-12 14:14:20 -0400 |
| commit | 9e9d0f1d410f806b546abed6055b25ac81f7042e (patch) | |
| tree | 5a13b54820988c87f3567f90a1c5280763fc885e /Propellor/Exception.hs | |
| parent | 61ed9ef26c275ee8466e3d86b0a9b5ae275e3d4e (diff) | |
| parent | b3af5e44d0683033043511fefa3c5fc0ca2a4073 (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'Propellor/Exception.hs')
| -rw-r--r-- | Propellor/Exception.hs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Propellor/Exception.hs b/Propellor/Exception.hs index bd9212a8..f6fd15f1 100644 --- a/Propellor/Exception.hs +++ b/Propellor/Exception.hs @@ -4,13 +4,15 @@ module Propellor.Exception where import qualified "MonadCatchIO-transformers" Control.Monad.CatchIO as M import Control.Exception -import Control.Applicative import Propellor.Types +import Propellor.Message -- | Catches IO exceptions and returns FailedChange. catchPropellor :: Propellor Result -> Propellor Result -catchPropellor a = either (\_ -> FailedChange) id <$> tryPropellor a +catchPropellor a = either err return =<< tryPropellor a + where + err e = warningMessage (show e) >> return FailedChange tryPropellor :: Propellor a -> Propellor (Either IOException a) tryPropellor = M.try |
