summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@ing.unitn.it>2007-06-26 07:17:47 +0200
committerAndrea Rossato <andrea.rossato@ing.unitn.it>2007-06-26 07:17:47 +0200
commita5bb15b5210fb849b2c4407dfee8288988f27fa5 (patch)
tree1f0e4fc9e907d15eb476099555efffcd7fd2985e
parentf081aaa45882887f6f21822bc2f90fb701b49257 (diff)
downloadxmobar-a5bb15b5210fb849b2c4407dfee8288988f27fa5.tar.gz
xmobar-a5bb15b5210fb849b2c4407dfee8288988f27fa5.tar.bz2
better error handling
darcs-hash:20070626051747-d6583-74d1f5aba0eb10ee530b699a9e9757dc96d1b13a.gz
-rw-r--r--xmobar.hs5
1 files changed, 3 insertions, 2 deletions
diff --git a/xmobar.hs b/xmobar.hs
index 1c40497..50e7c7b 100644
--- a/xmobar.hs
+++ b/xmobar.hs
@@ -212,6 +212,7 @@ getOptions c com =
-- | Runs a list of programs
execCommands :: Config -> [(String,String,String)] -> IO String
execCommands _ [] = return ""
+execCommands _ ((_,"",_):_) = return "Could not parse template"
execCommands c ((s,com,ss):xs) =
do i <- runCom c com
is <- execCommands c xs
@@ -245,7 +246,7 @@ formatting template.
parseString :: Config -> String -> IO [(String, String)]
parseString config s =
case (parse (stringParser config) "" s) of
- Left _ -> return [("Sorry, if I were a decent parser you now would be starring at something meaningful..."
+ Left _ -> return [("Could not parse string: " ++ s
, (fgColor config))]
Right x -> return x
@@ -299,7 +300,7 @@ templateParser c = many (templateStringParser c <|> templateCommandParser c)
parseTemplate :: Config -> String -> IO [(String,String,String)]
parseTemplate config s =
case (parse (templateParser config) "" s) of
- Left _ -> return [("Could not parse templete","","")]
+ Left _ -> return [("","","")]
Right x -> return x
{- $unmanwin