1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 02:01:13 +00:00

#835: Make cache failure non-fatal

This commit is contained in:
Vladimir Iakovlev 2018-10-18 00:35:18 +02:00
parent f06ebbf2ae
commit d226b8f258

View File

@ -3,11 +3,12 @@ import os
import pickle
import re
import shelve
import sys
import six
from decorator import decorator
from difflib import get_close_matches as difflib_get_close_matches
from functools import wraps
from .logs import warn
from .logs import warn, exception
from .conf import settings
from .system import Path
@ -197,6 +198,13 @@ class Cache(object):
self._db = None
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_path = Path(cache_dir).joinpath('thefuck').as_posix()