diff options
author | Joey Hess <joey@kitenet.net> | 2011-11-10 20:24:24 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-11-10 20:57:28 -0400 |
commit | 49d2177d51b95b4a01c05ee07e166e93751b4c51 (patch) | |
tree | b818865e5a924dc90bf0a79608351b1aeffe458a /git-annex-shell.hs | |
parent | a71c03bc5162916853ff520d5c7c89e849c6a047 (diff) |
factored out some useful error catching methods
Diffstat (limited to 'git-annex-shell.hs')
-rw-r--r-- | git-annex-shell.hs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/git-annex-shell.hs b/git-annex-shell.hs index 12cc65e4d..57f6b2916 100644 --- a/git-annex-shell.hs +++ b/git-annex-shell.hs @@ -104,9 +104,6 @@ checkNotReadOnly cmd | otherwise = checkEnv "GIT_ANNEX_SHELL_READONLY" checkEnv :: String -> IO () -checkEnv var = catch check (const $ return ()) - where - check = do - val <- getEnv var - when (not $ null val) $ - error $ "Action blocked by " ++ var +checkEnv var = + whenM (not . null <$> catchDefaultIO (getEnv var) "") $ + error $ "Action blocked by " ++ var |