From f0fbdce8fd8369eaa78dfff02aca79fb61170931 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 20 Jun 2016 10:51:42 -0400 Subject: handle SomeAsyncException same as AsyncException This new type was added to base a while ago; I don't know what uses it, but it's intended to be an async exception, so make sure we don't catch it. --- src/Propellor/Exception.hs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/Propellor/Exception.hs') diff --git a/src/Propellor/Exception.hs b/src/Propellor/Exception.hs index 3ab783bf..2e8754dc 100644 --- a/src/Propellor/Exception.hs +++ b/src/Propellor/Exception.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE CPP, ScopedTypeVariables #-} module Propellor.Exception where @@ -8,11 +8,14 @@ import Propellor.Message import Utility.Exception import Control.Exception (AsyncException) +#if MIN_VERSION_base(4,7,0) +import Control.Exception (SomeAsyncException) +#endif import Control.Monad.Catch import Control.Monad.IO.Class (MonadIO) -- | Catches all exceptions (except for `StopPropellorException` and --- `AsyncException`) and returns FailedChange. +-- `AsyncException` and `SomeAsyncException`) and returns FailedChange. catchPropellor :: (MonadIO m, MonadCatch m) => m Result -> m Result catchPropellor a = either err return =<< tryPropellor a where @@ -21,6 +24,9 @@ catchPropellor a = either err return =<< tryPropellor a catchPropellor' :: MonadCatch m => m a -> (SomeException -> m a) -> m a catchPropellor' a onerr = a `catches` [ Handler (\ (e :: AsyncException) -> throwM e) +#if MIN_VERSION_base(4,7,0) + , Handler (\ (e :: SomeAsyncException) -> throwM e) +#endif , Handler (\ (e :: StopPropellorException) -> throwM e) , Handler (\ (e :: SomeException) -> onerr e) ] -- cgit v1.2.3