diff options
| author | Joey Hess <joey@kitenet.net> | 2014-04-11 01:09:01 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-04-11 01:09:01 -0400 |
| commit | 856ce97995bc34e35fd8e0233341f26a37b19cf5 (patch) | |
| tree | 1d93492b36cd07d58437d2cb0f902ad53b3abe6e /Propellor/Exception.hs | |
| parent | 07a071ac7f5b2f71e376a9a1a78a84a6bf02129b (diff) | |
| parent | 47ff089f844c707eaa3ffd7255dc733721fb6adf (diff) | |
Merge branch 'joeyconfig'
Diffstat (limited to 'Propellor/Exception.hs')
| -rw-r--r-- | Propellor/Exception.hs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Propellor/Exception.hs b/Propellor/Exception.hs new file mode 100644 index 00000000..bd9212a8 --- /dev/null +++ b/Propellor/Exception.hs @@ -0,0 +1,16 @@ +{-# LANGUAGE PackageImports #-} + +module Propellor.Exception where + +import qualified "MonadCatchIO-transformers" Control.Monad.CatchIO as M +import Control.Exception +import Control.Applicative + +import Propellor.Types + +-- | Catches IO exceptions and returns FailedChange. +catchPropellor :: Propellor Result -> Propellor Result +catchPropellor a = either (\_ -> FailedChange) id <$> tryPropellor a + +tryPropellor :: Propellor a -> Propellor (Either IOException a) +tryPropellor = M.try |
