Skip to content

Commit

Permalink
Log IMAP errors to log in English, not current user's language
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Jan 28, 2014
1 parent 8b71c1e commit 0b14c18
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
6 changes: 3 additions & 3 deletions imp/bin/imp-query-imap-cache
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ try {
$mboxes = $ob->listMailboxes('*', Horde_Imap_Client::MBOX_ALL, array('flat' => true, 'sort' => true));
$cli->message('User mailbox count: ' . count($mboxes));
} catch (Horde_Imap_Client_Exception $e) {
$cli->fatal('IMAP error: ' . $e->getMessage());
$cli->fatal('IMAP error: ' . $e);
}

$opts = array(
Expand Down Expand Up @@ -213,7 +213,7 @@ while (true) {
$status = $ob->status($mbox, Horde_Imap_Client::STATUS_UIDVALIDITY | Horde_Imap_Client::STATUS_HIGHESTMODSEQ);
} catch (Horde_Imap_Client_Exception $e) {
$cli->writeln();
$cli->message('IMAP error: ' . $e->getMessage(), 'cli.error');
$cli->message('IMAP error: ' . $e, 'cli.error');
}
$cli->message('UIDVALIDITY: ' . $res['uidvalid'] . ' [Server value: ' . (($status['uidvalidity'] != $res['uidvalid']) ? $cli->red($status['uidvalidity']) : $status['uidvalidity']) . ']');
if (isset($res[Horde_Imap_Client_Base::CACHE_MODSEQ])) {
Expand Down Expand Up @@ -303,7 +303,7 @@ while (true) {
$cli->message(sprintf('Deleted %d UIDs from cache.', count($uids)), 'cli.success');
} catch (Horde_Imap_Client_Exception $e) {
$cli->writeln();
$cli->message('Failed deleting UIDs. Error: ' . $e->getMessage(), 'cli.error');
$cli->message('Failed deleting UIDs. Error: ' . $e, 'cli.error');
}
break;
}
Expand Down
5 changes: 4 additions & 1 deletion imp/lib/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,10 @@ public function download(Horde_Variables $vars)
public function exceptionHandler(Exception $e)
{
if ($e instanceof Horde_Imap_Client_Exception) {
$e = new Horde_Exception_AuthenticationFailure($e->getMessage(), Horde_Auth::REASON_MESSAGE);
$e = new Horde_Exception_AuthenticationFailure(
$e->getMessage(),
Horde_Auth::REASON_MESSAGE
);
}

Horde_ErrorHandler::fatal($e);
Expand Down
7 changes: 3 additions & 4 deletions imp/lib/Imap.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,8 @@ public function createImapObject($config, $imap = true)
: new Horde_Imap_Client_Socket_Pop3($config);
return $this->_ob;
} catch (Horde_Imap_Client_Exception $e) {
$error = new IMP_Imap_Exception($e);
Horde::log($error);
throw $error;
Horde::log($e->raw_msg);
throw new IMP_Imap_Exception($e);
}
}

Expand Down Expand Up @@ -713,7 +712,7 @@ public function __call($method, $params)
throw $auth_e;
}

Horde::log($error);
Horde::log($e->raw_msg);
throw $error;
}

Expand Down
2 changes: 1 addition & 1 deletion imp/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@
<package>
<name>Horde_Imap_Client</name>
<channel>pear.horde.org</channel>
<min>2.17.0</min>
<min>2.18.0</min>
<max>3.0.0alpha1</max>
<exclude>3.0.0alpha1</exclude>
</package>
Expand Down

0 comments on commit 0b14c18

Please sign in to comment.