Commit 6a062ff9 authored by Iustin Pop's avatar Iustin Pop

htools: make some error messages more explicit

Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarMichael Hanselmann <hansmi@google.com>
parent 7c670076
......@@ -116,8 +116,8 @@ loadExternalData opts = do
(case ldresult of
Ok x -> return x
Bad s -> do
hPrintf stderr "Error: failed to load data. Details:\n%s\n" s
:: IO ()
hPrintf stderr
"Error: failed to load data, aborting. Details:\n%s\n" s:: IO ()
exitWith $ ExitFailure 1
)
let (fix_msgs, nl) = checkData (cdNodes cdata) (cdInstances cdata)
......
......@@ -59,7 +59,8 @@ genericConvert :: (Text.JSON.JSON a) =>
-> JSValue -- ^ The value we try to convert
-> Result a -- ^ The annotated result
genericConvert otype oname oattr =
annotateResult (otype ++ " '" ++ oname ++ "', attribute '" ++
annotateResult (otype ++ " '" ++ oname ++
"', error while reading attribute '" ++
oattr ++ "'") . fromJVal
-- * Data querying functionality
......
......@@ -107,7 +107,7 @@ parseInstance :: NameAssoc
-> Result (String, Instance.Instance)
parseInstance ktn a = do
name <- tryFromObj "Parsing new instance" a "name"
let owner_name = "Instance '" ++ name ++ "'"
let owner_name = "Instance '" ++ name ++ "', error while parsing data"
let extract s x = tryFromObj owner_name x s
disk <- extract "disk_usage" a
beparams <- liftM fromJSObject (extract "beparams" a)
......@@ -131,7 +131,7 @@ parseInstance ktn a = do
parseNode :: NameAssoc -> [(String, JSValue)] -> Result (String, Node.Node)
parseNode ktg a = do
name <- tryFromObj "Parsing new node" a "name"
let desc = "Node '" ++ name ++ "'"
let desc = "Node '" ++ name ++ "', error while parsing data"
extract s = tryFromObj desc a s
offline <- extract "offline"
drained <- extract "drained"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment