barbushin/php-imap

Error Handling Not working

iamved777 opened this issue · 0 comments

Hi!
I have checked various issues in issues section but not found proper method for handle errors.

try {
            
    $mailbox = new Mailbox($hoststring, 'example@gmail.com', "adadadaadaadd", false);
    try {
        $mail_ids = $mailbox->searchMailbox('ALL');
    } catch (ConnectionException $ex) {
       $error = $ex->getMessage();
        echo $error;
    } catch (Exception $ex) {
        $error = $ex->getMessage();
        echo $error;
    }
                
 }catch (ConnectionException $ex) {
        $error = $ex->getMessage();
        echo $error;
        
    }catch (Exception $ex) {
        $error = $ex->getMessage();
        echo $error;
       
}

Its never echo error but instead giving fatal error on invalid password etc, Let me know if I am missing anything in this. Thanks!