Skip to content

Commit

Permalink
db: raise ValueError in unalias_nick to match documentation (#1102)
Browse files Browse the repository at this point in the history
Documentation says that a ValueError should be raised if there is not at least one other nick in the group.

Resolves #1101
  • Loading branch information
dgw authored and maxpowa committed Jul 19, 2016
1 parent 335a564 commit 4355aae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sopel/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def unalias_nick(self, alias):
nick_id = self.get_nick_id(alias, False)
count = self.execute('SELECT COUNT(*) FROM nicknames WHERE nick_id = ?',
[nick_id]).fetchone()[0]
if count == 0:
if count <= 1:
raise ValueError('Given alias is the only entry in its group.')
self.execute('DELETE FROM nicknames WHERE slug = ?', [alias.lower()])

Expand Down

0 comments on commit 4355aae

Please sign in to comment.