diff options
author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-06-26 07:17:47 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-06-26 07:17:47 +0200 |
commit | a5bb15b5210fb849b2c4407dfee8288988f27fa5 (patch) | |
tree | 1f0e4fc9e907d15eb476099555efffcd7fd2985e | |
parent | f081aaa45882887f6f21822bc2f90fb701b49257 (diff) | |
download | xmobar-a5bb15b5210fb849b2c4407dfee8288988f27fa5.tar.gz xmobar-a5bb15b5210fb849b2c4407dfee8288988f27fa5.tar.bz2 |
better error handling
darcs-hash:20070626051747-d6583-74d1f5aba0eb10ee530b699a9e9757dc96d1b13a.gz
-rw-r--r-- | xmobar.hs | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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 |