/** * @param \CAccount $oAccount * @param string $sActionName * @param \Exception $oException * @param array $aAdditionalParams = null * * @return array */ public function ExceptionResponse($oAccount, $sActionName, $oException, $aAdditionalParams = null) { $iErrorCode = null; $sErrorMessage = null; $bShowError = \CApi::GetConf('labs.webmail.display-server-error-information', false); if ($oException instanceof \ProjectCore\Exceptions\ClientException) { $iErrorCode = $oException->getCode(); $sErrorMessage = null; if ($bShowError) { $sErrorMessage = $oException->getMessage(); if (empty($sErrorMessage) || 'ClientException' === $sErrorMessage) { $sErrorMessage = null; } } } else { if ($bShowError && $oException instanceof \MailSo\Imap\Exceptions\ResponseException) { $iErrorCode = \ProjectCore\Notifications::MailServerError; $oResponse = $oException->GetLastResponse(); if ($oResponse instanceof \MailSo\Imap\Response) { $sErrorMessage = $oResponse instanceof \MailSo\Imap\Response ? $oResponse->Tag . ' ' . $oResponse->StatusOrIndex . ' ' . $oResponse->HumanReadable : null; } } else { $iErrorCode = \ProjectCore\Notifications::UnknownError; // $sErrorMessage = $oException->getCode().' - '.$oException->getMessage(); } } return $this->FalseResponse($oAccount, $sActionName, $iErrorCode, $sErrorMessage, $aAdditionalParams); }
/** * @return string */ public function GetPreviousMessage() { $sMessage = ''; if ($this->oPrevious instanceof \MailSo\Imap\Exceptions\NegativeResponseException) { $oResponse = $this->oPrevious->GetLastResponse(); $sMessage = $oResponse instanceof \MailSo\Imap\Response ? $oResponse->Tag . ' ' . $oResponse->StatusOrIndex . ' ' . $oResponse->HumanReadable : ''; } else { if ($this->oPrevious instanceof \MailSo\Smtp\Exceptions\NegativeResponseException) { $sMessage = $this->oPrevious->getMessage(); // $oSub = $this->oPrevious->getPrevious(); // $oSub = $oSub instanceof \MailSo\Smtp\Exceptions\NegativeResponseException ? $oSub : null; // // $sMessage = $oSub ? $oSub->getMessage() : $this->oPrevious->getMessage(); } else { if ($this->oPrevious instanceof \Exception) { $sMessage = $this->oPrevious->getMessage(); } } } return $sMessage; }