mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-24 03:33:11 +01:00
Better error handling on open.
This commit is contained in:
parent
3776788694
commit
68eb84c0bb
12
src/ircdb.py
12
src/ircdb.py
@ -516,7 +516,11 @@ class UsersDictionary(utils.IterableMap):
|
||||
def open(self, filename):
|
||||
self.filename = filename
|
||||
reader = unpreserve.Reader(IrcUserCreator, self)
|
||||
reader.readFile(filename)
|
||||
try:
|
||||
reader.readFile(filename)
|
||||
except Exception, e:
|
||||
log.error('Invalid user dictionary file, starting from scratch.')
|
||||
log.error('Exact error: %s', utils.exnToString(e))
|
||||
|
||||
def reload(self):
|
||||
"""Reloads the database from its file."""
|
||||
@ -675,7 +679,11 @@ class ChannelsDictionary(utils.IterableMap):
|
||||
def open(self, filename):
|
||||
self.filename = filename
|
||||
reader = unpreserve.Reader(IrcChannelCreator, self)
|
||||
reader.readFile(filename)
|
||||
try:
|
||||
reader.readFile(filename)
|
||||
except Exception, e:
|
||||
log.error('Invalid channel database, starting from scratch.')
|
||||
log.error('Exact error: %s', utils.exnToString(e))
|
||||
|
||||
def flush(self):
|
||||
"""Flushes the channel database to its file."""
|
||||
|
Loading…
Reference in New Issue
Block a user