From a5bb15b5210fb849b2c4407dfee8288988f27fa5 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 26 Jun 2007 07:17:47 +0200 Subject: better error handling darcs-hash:20070626051747-d6583-74d1f5aba0eb10ee530b699a9e9757dc96d1b13a.gz --- xmobar.hs | 5 +++-- 1 file 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 -- cgit v1.2.3