Skip to content

Conversation

@simonLeary42
Copy link
Collaborator

  • add $this->dn to getLdapErrorInfo
  • add $this->mods to getLdapErrorInfo instead of in write
  • remove funcname from LDAP error info in write, since it should be redundant
  • create new class LDAPException
  • modify getLdapErrorInfo to automatically throw an LDAPException, rename to ensureLdapSuccess
  • remove exception throwing from write, delete
  • modify move to throw an exception instead of returning false, like the other functions
  • modify move to return void instead of a new LDAPEntry object, like the other functions
    • this function is not used in the web portal
  • add try/finally to write, delete, move so that $this->mods will be reset and pullObject will still be run even after an error

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors LDAP error handling by consolidating error information gathering, introducing a dedicated exception class, and improving error handling consistency across LDAP operations.

  • Replaces getLdapErrorInfo() with ensureLdapSuccess() that automatically throws LDAPException on errors
  • Adds try/finally blocks to ensure cleanup operations execute even when exceptions are thrown
  • Modifies move() method to throw exceptions instead of returning false and changes return type to void

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/PHPOpenLDAPer/LDAPException.php Adds new exception class extending base Exception
src/PHPOpenLDAPer/LDAPEntry.php Refactors error handling methods and adds exception safety to LDAP operations

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants