diff options
| author | Joey Hess <joeyh@joeyh.name> | 2016-05-22 15:41:28 -0400 |
|---|---|---|
| committer | Joey Hess <joeyh@joeyh.name> | 2016-05-22 15:41:28 -0400 |
| commit | 14e5429163f0138f03deaaa1134c8b4982c27141 (patch) | |
| tree | 37f8b19e1ee75754e38ebb681af8ddb30f03500d /src/Utility/Exception.hs | |
| parent | af00ff05913441cd4860c66aaf1d7a20a55b6d76 (diff) | |
merge Utility from git-annex
Diffstat (limited to 'src/Utility/Exception.hs')
| -rw-r--r-- | src/Utility/Exception.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Utility/Exception.hs b/src/Utility/Exception.hs index 8b110ae6..e691f13b 100644 --- a/src/Utility/Exception.hs +++ b/src/Utility/Exception.hs @@ -21,7 +21,8 @@ module Utility.Exception ( tryNonAsync, tryWhenExists, catchIOErrorType, - IOErrorType(..) + IOErrorType(..), + catchPermissionDenied, ) where import Control.Monad.Catch as X hiding (Handler) @@ -97,3 +98,6 @@ catchIOErrorType errtype onmatchingerr a = catchIO a onlymatching onlymatching e | ioeGetErrorType e == errtype = onmatchingerr e | otherwise = throwM e + +catchPermissionDenied :: MonadCatch m => (IOException -> m a) -> m a -> m a +catchPermissionDenied = catchIOErrorType PermissionDenied |
