Print a more useful error message if the statefile can't be read.
authorAdam Sampson <ats@offog.org>
Sun, 12 Oct 2003 00:12:05 +0000 (00:12 +0000)
committerAdam Sampson <ats@offog.org>
Sun, 12 Oct 2003 00:12:05 +0000 (00:12 +0000)
rawdoglib/rawdog.py

index dfa03498f835866f9cee1846e407f3c09b27404d..aeaf384f59f108f068fee368e89b57edd1f7a7fc 100644 (file)
@@ -591,7 +591,12 @@ def main(argv):
                return 1
 
        persister = Persister("state", Rawdog)
-       rawdog = persister.load()
+       try:
+               rawdog = persister.load()
+       except:
+               print "An error occurred while reading state from ~/.rawdog/state."
+               print "This usually means the file is corrupt, and removing it will fix the problem."
+               return 1
 
        for o, a in optlist:
                if o in ("-u", "--update"):