##// END OF EJS Templates
Avoid crash if the history table cannot be queried for some reason. Fixes #8310.
Omer Katz -
Show More
@@ -70,10 +70,15 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."
78
79 @undoc
80 class OperationalError(Exception):
81 "Dummy exception when sqlite could not be imported. Should never occur."
77
82
78 @decorator
83 @decorator
79 def catch_corrupt_db(f, self, *a, **kw):
84 def catch_corrupt_db(f, self, *a, **kw):
@@ -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