cache_info = cache_info.split(' ')
self.version = cache_info[0]
if(self.version != CACHE_VERSION):
- logging.warning("Cache file has version %s and the script version is %s. Deleting cache.",
- self.version, CACHE_VERSION)
- raise IOError
+ raise IOError("Cache file has version %s and the script version is %s" % (self.version, CACHE_VERSION))
self.fallback_to_date_header = cache_info[1]
if(self.fallback_to_date_header != str(fallback_mode)):
- logging.warning("Cache file date fallback mode setting is different than current settings. Deleting cache.")
- raise IOError
+ raise IOError("Cache file date fallback mode setting is different than current settings")
logging.info("Cache file %s loaded", CACHE_FILENAME)
- logging.debug("%s users found.", len(self.data))
- except IOError:
+ logging.info("%s users found.", len(self.data))
+ except (IOError, ValueError) as ex:
+ logging.warning("Couldn't load cache file %s: %s", CACHE_FILENAME, ex)
+ logging.warning("DELETING CACHE")
self.version = CACHE_VERSION
stored_cache_info = self.version + ' ' + str(fallback_mode)
self.data = {}