It would be very helpful to have a constructor (or builder-style API) for LDAPException that allows setting distinct values for errorMessage and diagnosticMessage.
Several LDAP server implementations use the diagnosticMessage field to provide additional detail beyond the primary errorMessage, which can be extremely helpful for troubleshooting and debugging.
For example:
resultCode=ENTRY_ALREADY_EXISTS
errorMessage="Key already exists"
diagnosticMessage="Both dc=foo and dc=bar would match the index xyz"
At the moment, it does not appear possible to populate these fields independently when creating an LDAPException, which limits the ability to convey detailed context to clients.