Delay error in users.get until after the end of the loop
This was originally done so that we wouldn't need to iterate through the (presumably large) set of users. However, when this raises, we have no idea which users actually match the criterias. By waiting until after, the traceback will actually print off the list of all potential users.
This commit is contained in:
parent
21b8ffa342
commit
5f50096d08
@ -64,12 +64,13 @@ def _get(nick=None, ident=None, host=None, realname=None, account=None, *, allow
|
||||
|
||||
for user in users:
|
||||
if user == temp:
|
||||
if not potential or allow_multiple:
|
||||
potential.append(user)
|
||||
else:
|
||||
|
||||
if not allow_multiple and len(potential) > 1:
|
||||
raise ValueError("More than one user matches: " +
|
||||
_arg_msg.format(nick, ident, host, realname, account, allow_bot))
|
||||
|
||||
|
||||
if not potential and not allow_multiple and not allow_none:
|
||||
raise KeyError(_arg_msg.format(nick, ident, host, realname, account, allow_bot))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user