##// END OF EJS Templates
Merge pull request #8311 from thedrow/topic/fix-history-crash...
Matthias Bussonnier -
r21260:d56cbbe7 merge
parent child Browse files
Show More
@@ -70,11 +70,16 b' def needs_sqlite(f, self, *a, **kw):'
70
70
71 if sqlite3 is not None:
71 if sqlite3 is not None:
72 DatabaseError = sqlite3.DatabaseError
72 DatabaseError = sqlite3.DatabaseError
73 OperationalError = sqlite3.OperationalError
73 else:
74 else:
74 @undoc
75 @undoc
75 class DatabaseError(Exception):
76 class DatabaseError(Exception):
76 "Dummy exception when sqlite could not be imported. Should never occur."
77 "Dummy exception when sqlite could not be imported. Should never occur."
77
78
79 @undoc
80 class OperationalError(Exception):
81 "Dummy exception when sqlite could not be imported. Should never occur."
82
78 @decorator
83 @decorator
79 def catch_corrupt_db(f, self, *a, **kw):
84 def catch_corrupt_db(f, self, *a, **kw):
80 """A decorator which wraps HistoryAccessor method calls to catch errors from
85 """A decorator which wraps HistoryAccessor method calls to catch errors from
@@ -83,7 +88,7 b' def catch_corrupt_db(f, self, *a, **kw):'
83 """
88 """
84 try:
89 try:
85 return f(self, *a, **kw)
90 return f(self, *a, **kw)
86 except DatabaseError:
91 except (DatabaseError, OperationalError):
87 if os.path.isfile(self.hist_file):
92 if os.path.isfile(self.hist_file):
88 # Try to move the file out of the way
93 # Try to move the file out of the way
89 base,ext = os.path.splitext(self.hist_file)
94 base,ext = os.path.splitext(self.hist_file)
General Comments 0
You need to be logged in to leave comments. Login now