Implements error handling #11

Prints IMAP errors and alerts to the nextcloud log.

Signed-off-by: Anojh Thayaparan <anojh@hotmail.com>
This commit is contained in:
Anojh Thayaparan
2019-01-28 03:31:05 -08:00
parent 5df00dc149
commit d83a883a1c

View File

@@ -67,8 +67,14 @@ class OC_User_IMAP extends \OCA\user_external\Base {
}
$mbox = @imap_open($this->mailbox, $username, $password, OP_HALFOPEN, 1);
imap_errors();
imap_alerts();
OC::$server->getLogger()->error(
'ERROR: IMAP Error: ' . print_r(imap_errors(), true),
['app' => 'user_external']
);
OC::$server->getLogger()->error(
'ERROR: IMAP Warning: ' . print_r(imap_alerts(), true),
['app' => 'user_external']
);
if($mbox !== false) {
imap_close($mbox);
$uid = mb_strtolower($uid);