Revision 30d25dd8 htools/Ganeti/HTools/Rapi.hs
b/htools/Ganeti/HTools/Rapi.hs | ||
---|---|---|
30 | 30 |
, parseData |
31 | 31 |
) where |
32 | 32 |
|
33 |
import Control.Exception |
|
33 | 34 |
import Data.List (isPrefixOf) |
34 | 35 |
import Data.Maybe (fromMaybe) |
35 | 36 |
#ifndef NO_CURL |
... | ... | |
37 | 38 |
import Network.Curl.Types () |
38 | 39 |
#endif |
39 | 40 |
import Control.Monad |
41 |
import Prelude hiding (catch) |
|
40 | 42 |
import Text.JSON (JSObject, fromJSObject, decodeStrict) |
41 | 43 |
import Text.JSON.Types (JSValue(..)) |
42 | 44 |
import Text.Printf (printf) |
... | ... | |
83 | 85 |
-- | Helper to convert I/O errors in 'Bad' values. |
84 | 86 |
ioErrToResult :: IO a -> IO (Result a) |
85 | 87 |
ioErrToResult ioaction = |
86 |
catch (ioaction >>= return . Ok) (return . Bad . show) |
|
88 |
catch (ioaction >>= return . Ok) |
|
89 |
(\e -> return . Bad . show $ (e::IOException)) |
|
87 | 90 |
|
88 | 91 |
-- | Append the default port if not passed in. |
89 | 92 |
formatHost :: String -> String |
Also available in: Unified diff