mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +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):
|
def open(self, filename):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
reader = unpreserve.Reader(IrcUserCreator, self)
|
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):
|
def reload(self):
|
||||||
"""Reloads the database from its file."""
|
"""Reloads the database from its file."""
|
||||||
@ -675,7 +679,11 @@ class ChannelsDictionary(utils.IterableMap):
|
|||||||
def open(self, filename):
|
def open(self, filename):
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
reader = unpreserve.Reader(IrcChannelCreator, self)
|
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):
|
def flush(self):
|
||||||
"""Flushes the channel database to its file."""
|
"""Flushes the channel database to its file."""
|
||||||
|
Loading…
Reference in New Issue
Block a user