<?php
/**
* SeekQuarry/Yioop --
* Open Source Pure PHP Search Engine, Crawler, and Indexer
*
* Copyright (C) 2009 - 2026 Chris Pollett chris@pollett.org
*
* LICENSE:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* END LICENSE
*
* @author Chris Pollett chris@pollett.org
* @license https://www.gnu.org/licenses/ GPL3
* @link https://www.seekquarry.com/
* @copyright 2009 - 2026
* @filesource
*/
namespace seekquarry\yioop\library\mail;
/**
* Exception type thrown by MailBackend implementations on
* transport failure, missing resources, or invalid arguments.
*
* The message carried by this exception is intended to be
* already localized via tl(); callers can put it directly into
* $data['MAIL_ERROR'] and the view will render it as-is. The
* underlying throwable from the IMAP client or other low-level
* source, when available, is exposed via the standard
* Exception::getPrevious() for log instrumentation.
*
* @author Chris Pollett
*/
class MailBackendException extends \Exception
{
/**
* Whether this failure looks like a transient connection-level
* problem (socket dropped mid-response, connection refused or
* timed out, server hung up) as opposed to a definitive error
* (authentication rejected, certificate invalid, mailbox
* missing). Transient failures are worth retrying on a later
* run rather than abandoning the operation; the mail-clone job
* uses this to end the current tick and resume the clone on the
* next MediaUpdater pass instead of marking the whole job
* failed. Defaults to false: only failures explicitly
* classified as connection-level set it true.
*
* @var bool
*/
protected $transient = false;
/**
* Records whether this failure is a transient connection-level
* problem worth retrying later.
*
* @param bool $is_transient true to mark the failure transient
* @return void
*/
public function setTransient($is_transient)
{
$this->transient = (bool) $is_transient;
}
/**
* Whether this failure is a transient connection-level problem
* worth retrying later rather than a definitive error.
*
* @return bool true when the failure is transient
*/
public function isTransient()
{
return $this->transient;
}
}