inform user when databas is malformed. Fixes #4428

This commit is contained in:
Yann Leboulanger 2008-10-22 15:48:35 +00:00
parent 72f30bd80b
commit e2a511b379
1 changed files with 24 additions and 0 deletions

View File

@ -1837,6 +1837,12 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
subject=subject)
except exceptions.PysqliteOperationalError, e:
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
except exceptions.DatabaseMalformed:
pritext = _('Database Error')
sectext = _('The database file (%s) cannot be read. Try to repair '
'it or remove it (all history will be lost).') % \
common.logger.LOG_DB_PATH
self.dispatch('ERROR', (pritext, sectext))
self.dispatch('MSGERROR', (frm, msg.getErrorCode(), error_msg, msgtxt,
tim, session))
@ -1877,6 +1883,12 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
gajim.logger.write('gc_msg', frm, msgtxt, tim=tim)
except exceptions.PysqliteOperationalError, e:
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
except exceptions.DatabaseMalformed:
pritext = _('Database Error')
sectext = _('The database file (%s) cannot be read. Try to repair '
'it or remove it (all history will be lost).') % \
common.logger.LOG_DB_PATH
self.dispatch('ERROR', (pritext, sectext))
def dispatch_invite_message(self, invite, frm):
item = invite.getTag('invite')
@ -2059,6 +2071,12 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
gajim.logger.write('gcstatus', who, st, show)
except exceptions.PysqliteOperationalError, e:
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
except exceptions.DatabaseMalformed:
pritext = _('Database Error')
sectext = _('The database file (%s) cannot be read. Try to '
'repair it or remove it (all history will be lost).') % \
common.logger.LOG_DB_PATH
self.dispatch('ERROR', (pritext, sectext))
if avatar_sha or avatar_sha == '':
if avatar_sha == '':
# contact has no avatar
@ -2178,6 +2196,12 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco,
gajim.logger.write('status', jid_stripped, status, show)
except exceptions.PysqliteOperationalError, e:
self.dispatch('ERROR', (_('Disk Write Error'), str(e)))
except exceptions.DatabaseMalformed:
pritext = _('Database Error')
sectext = _('The database file (%s) cannot be read. Try to '
'repair it or remove it (all history will be lost).') % \
common.logger.LOG_DB_PATH
self.dispatch('ERROR', (pritext, sectext))
our_jid = gajim.get_jid_from_account(self.name)
if jid_stripped == our_jid and resource == self.server_resource:
# We got our own presence