{"action":"created","issue":{"url":"https://api.github.com/repos/Adldap2/Adldap2/issues/111","labels_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/111/labels{/name}","comments_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/111/comments","events_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/111/events","html_url":"https://github.com/Adldap2/Adldap2/issues/111","id":112724122,"number":111,"title":"No exception thrown when initial bind fails","user":{"login":"chriseskow","id":19055,"avatar_url":"https://avatars.githubusercontent.com/u/19055?v=3","gravatar_id":"","url":"https://api.github.com/users/chriseskow","html_url":"https://github.com/chriseskow","followers_url":"https://api.github.com/users/chriseskow/followers","following_url":"https://api.github.com/users/chriseskow/following{/other_user}","gists_url":"https://api.github.com/users/chriseskow/gists{/gist_id}","starred_url":"https://api.github.com/users/chriseskow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriseskow/subscriptions","organizations_url":"https://api.github.com/users/chriseskow/orgs","repos_url":"https://api.github.com/users/chriseskow/repos","events_url":"https://api.github.com/users/chriseskow/events{/privacy}","received_events_url":"https://api.github.com/users/chriseskow/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Adldap2/Adldap2/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-22T03:24:24Z","updated_at":"2015-10-22T19:21:15Z","closed_at":"2015-10-22T17:54:18Z","body":"When you autoconnect with an admin username/password, it's rather difficult to determine whether or not the initial bind succeeded because no exceptions are thrown. It seems the most direct way to check is by calling `$ad->getConnection()->isBound()`, which is a pretty roundabout way of checking if `$ad` is ready to be used.\r\n\r\nThis seems to be happening because `authenticate()` swallows any exceptions thrown while binding and returns immediately. I'm guessing this is because `authenticate()`'s contract is to return a boolean instead of throwing exceptions... though it *does* throw exceptions when *re*binding...\r\n\r\nIf we can't make `authenticate()` throw an exception then perhaps we could modify either `connect()` or `__construct()` to throw an exception if `authenticate()` returns false. However that won't get us the root cause (e.g. bad hostname vs invalid credentials, etc.) without storing the details of the exception that was caught in `authenticate()`.\r\n\r\nIs there a better way to do error handling that I'm missing?"},"comment":{"url":"https://api.github.com/repos/Adldap2/Adldap2/issues/comments/150328089","html_url":"https://github.com/Adldap2/Adldap2/issues/111#issuecomment-150328089","issue_url":"https://api.github.com/repos/Adldap2/Adldap2/issues/111","id":150328089,"user":{"login":"stevebauman","id":6421846,"avatar_url":"https://avatars.githubusercontent.com/u/6421846?v=3","gravatar_id":"","url":"https://api.github.com/users/stevebauman","html_url":"https://github.com/stevebauman","followers_url":"https://api.github.com/users/stevebauman/followers","following_url":"https://api.github.com/users/stevebauman/following{/other_user}","gists_url":"https://api.github.com/users/stevebauman/gists{/gist_id}","starred_url":"https://api.github.com/users/stevebauman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevebauman/subscriptions","organizations_url":"https://api.github.com/users/stevebauman/orgs","repos_url":"https://api.github.com/users/stevebauman/repos","events_url":"https://api.github.com/users/stevebauman/events{/privacy}","received_events_url":"https://api.github.com/users/stevebauman/received_events","type":"User","site_admin":false},"created_at":"2015-10-22T19:21:15Z","updated_at":"2015-10-22T19:21:15Z","body":"No problem. Done! https://github.com/Adldap2/Adldap2/commit/9a863e49aa18bb1643d8c229d56520ae6813b7fb"}}