diff options
| author | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-24 14:01:06 +0200 | 
|---|---|---|
| committer | Andrea Rossato <andrea.rossato@ing.unitn.it> | 2007-07-24 14:01:06 +0200 | 
| commit | 60d538f76659f343b5fcdbb0ecbec6e157bdba91 (patch) | |
| tree | 47c3b35c92170024d6efbaf81e3a348eb63c85e5 | |
| parent | bcb7793d5444be36bcb999409771d4493ec157a9 (diff) | |
| download | xmobar-60d538f76659f343b5fcdbb0ecbec6e157bdba91.tar.gz xmobar-60d538f76659f343b5fcdbb0ecbec6e157bdba91.tar.bz2  | |
better error handling in Main.hs
darcs-hash:20070724120106-d6583-0a4a02d25dddcf0c005a295db06e4a009851292d.gz
| -rw-r--r-- | Main.hs | 7 | 
1 files changed, 4 insertions, 3 deletions
@@ -51,10 +51,11 @@ main =  -- | Reads the configuration files or quits with an error  readConfig :: FilePath -> IO Config  readConfig f =  -    do s <- readFile f +    do file <- fileExist f +       s <- if file then readFile f else error $ f ++ ": file not found!\n" ++ usage         case reads s of           [(config,_)] -> return config -         [] -> error ("Corrupt config file: " ++ f) +         [] -> error $ f ++ ": configuration file contains errors!\n" ++ usage           _ -> error ("Some problem occured. Aborting...")  -- | Read default configuration file or load the default config @@ -108,7 +109,7 @@ getOpts argv =  usage :: String  usage = (usageInfo header options) ++ footer      where header = "Usage: xmobar [OPTION...] [FILE]\nOptions:" -          footer = "Mail bug reports and suggestions to " ++ mail +          footer = "\nMail bug reports and suggestions to " ++ mail  version :: String  version = "Xmobar 0.7 (C) 2007 Andrea Rossato " ++ mail ++ license  | 
