From 495aeeafeb8428a2bbdf59cb10273847d98c46fe Mon Sep 17 00:00:00 2001 From: geistling <34081638+geistling@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:28:06 -0400 Subject: [PATCH] improve error message for return_user_by_name --- coldfront/plugins/ldap/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/coldfront/plugins/ldap/utils.py b/coldfront/plugins/ldap/utils.py index fe7deda18..0e7eeb9ae 100644 --- a/coldfront/plugins/ldap/utils.py +++ b/coldfront/plugins/ldap/utils.py @@ -164,9 +164,9 @@ def return_user_by_name(self, username, return_as='dict', attributes=ALL_ATTRIBU """Return an AD user entry by the username""" user = self.search_users({"uid": username}, return_as=return_as, attributes=attributes) if len(user) > 1: - raise ValueError("too many users in value returned") + raise ValueError(f"too many users in value returned for username {username}") if not user: - raise ValueError("no users returned") + raise ValueError(f"no users returned for username {username}") return user[0] def return_group_by_name(self, groupname, return_as='dict', attributes=ALL_ATTRIBUTES):