mirror of
				https://github.com/Thor77/TeamspeakStats.git
				synced 2025-11-03 23:32:45 -05:00 
			
		
		
		
	Catch KeyError from pickle.load
and log exception as warning instead of debug. KeyError seems to occur in Python2 instead of an UnpicklingError
This commit is contained in:
		
							parent
							
								
									c32ed0360f
								
							
						
					
					
						commit
						7acae1e45b
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -58,8 +58,8 @@ class Cache(MutableMapping):
 | 
			
		|||
            with open(path, 'rb') as f:
 | 
			
		||||
                try:
 | 
			
		||||
                    data = pickle.load(f)
 | 
			
		||||
                except EOFError or pickle.UnpicklingError:
 | 
			
		||||
                    logger.debug('Couldn\'t read cache')
 | 
			
		||||
                except (EOFError, pickle.UnpicklingError, KeyError):
 | 
			
		||||
                    logger.warning('Couldn\'t read cache')
 | 
			
		||||
        return cls(path, data)
 | 
			
		||||
 | 
			
		||||
    def write(self, path=None):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue