mirror of
				https://github.com/nvbn/thefuck.git
				synced 2025-10-30 22:54:14 +00:00 
			
		
		
		
	#835: Make cache failure non-fatal
This commit is contained in:
		| @@ -3,11 +3,12 @@ import os | |||||||
| import pickle | import pickle | ||||||
| import re | import re | ||||||
| import shelve | import shelve | ||||||
|  | import sys | ||||||
| import six | import six | ||||||
| from decorator import decorator | from decorator import decorator | ||||||
| from difflib import get_close_matches as difflib_get_close_matches | from difflib import get_close_matches as difflib_get_close_matches | ||||||
| from functools import wraps | from functools import wraps | ||||||
| from .logs import warn | from .logs import warn, exception | ||||||
| from .conf import settings | from .conf import settings | ||||||
| from .system import Path | from .system import Path | ||||||
|  |  | ||||||
| @@ -197,6 +198,13 @@ class Cache(object): | |||||||
|         self._db = None |         self._db = None | ||||||
|  |  | ||||||
|     def _init_db(self): |     def _init_db(self): | ||||||
|  |         try: | ||||||
|  |             self._setup_db() | ||||||
|  |         except Exception: | ||||||
|  |             exception("Unable to init cache", sys.exc_info()) | ||||||
|  |             self._db = {} | ||||||
|  |  | ||||||
|  |     def _setup_db(self): | ||||||
|         cache_dir = self._get_cache_dir() |         cache_dir = self._get_cache_dir() | ||||||
|         cache_path = Path(cache_dir).joinpath('thefuck').as_posix() |         cache_path = Path(cache_dir).joinpath('thefuck').as_posix() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user