When LDAP cannot be connected for some reason, the following message is displayed.
The error message is displayed as it is, but I don't know if it is a message from LDAP. You can understand that it is an LDAP message by adding a fixed message to the beginning as shown below.
I think that just simply adding the prefix "LDAP" to an error message is better.
LDAP: Connection refused - connect(2) for 192.0.2.1:389
The reasons are as follows:
Adding the prefix "LDAP" is enough to understand that there is a problem with communication with the LDAP server
We don't have to add a new string to the locales
Redmine may support new auth sources other than LDAP in the future. The following way of using auth_method_name method can be applied for new auth sources
diff --git a/app/models/auth_source_ldap.rb b/app/models/auth_source_ldap.rb
index 8ed7ce27f..846c7d2f3 100644
--- a/app/models/auth_source_ldap.rb
+++ b/app/models/auth_source_ldap.rb
@@ -63,7 +63,7 @@ class AuthSourceLdap < AuthSource
end
end
rescue *NETWORK_EXCEPTIONS => e
- raise AuthSourceException.new(e.message)
+ raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end
# Test the connection to the LDAP
@@ -77,7 +77,7 @@ class AuthSourceLdap < AuthSource
end
end
rescue *NETWORK_EXCEPTIONS => e
- raise AuthSourceException.new(e.message)
+ raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end
def auth_method_name
@@ -107,7 +107,7 @@ class AuthSourceLdap < AuthSource
end
results
rescue *NETWORK_EXCEPTIONS => e
- raise AuthSourceException.new(e.message)
+ raise AuthSourceException.new("#{auth_method_name}: #{e.message}")
end
def ldap_mode
I think that just simply adding the prefix "LDAP" to an error message is better.
[...]
The reasons are as follows:
Adding the prefix "LDAP" is enough to understand that there is a problem with communication with the LDAP server
We don't have to add a new string to the locales
Redmine may support new auth sources other than LDAP in the future. The following way of using auth_method_name method can be applied for new auth sources