From 1f49fc1e3e06d35ba2a0c87dad50e23119595b74 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 9 Mar 2005 10:43:01 +0000 Subject: [PATCH] Some small refactorings, fixed a problem in unsend. --- plugins/Note/plugin.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/Note/plugin.py b/plugins/Note/plugin.py index 14077798d..7837357bf 100644 --- a/plugins/Note/plugin.py +++ b/plugins/Note/plugin.py @@ -203,7 +203,7 @@ class Note(callbacks.Plugin): """ try: note = self.db.get(id) - except KeyError: + except dbi.NoRecordError: irc.error('That\'s not a note in my database.', Raise=True) if note.to != user.id: irc.error('You may only reply to notes ' @@ -226,7 +226,10 @@ class Note(callbacks.Plugin): Unsends the note with the id given. You must be the author of the note, and it must be unread. """ - note = self.db.get(id) + try: + note = self.db.get(id) + except dbi.NoRecordError: + irc.errorInvalid('note id') if note.frm == user.id: if not note.read: self.db.unsend(id) @@ -257,9 +260,8 @@ class Note(callbacks.Plugin): """ try: note = self.db.get(id) - except KeyError: - irc.error('That\'s not a valid note id.') - return + except dbi.NoRecordError: + irc.errorInvalid('note id') if user.id != note.frm and user.id != note.to: s = 'You may only retrieve notes you\'ve sent or received.' irc.error(s)