nextcloud/lib/public/TaskProcessing/Exception/UserFacingProcessingException.php
Marcel Klehr 3f527661b1 fix: Create new class instead of extending existing class
to make it easier to use this across nextcloud versions

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
2025-10-15 11:20:00 +02:00

52 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\TaskProcessing\Exception;
/**
* Exception thrown during processing of a task
* by a synchronous provider with the possibility to set a user-facing
* error message
*
* @since 33.0.0
*/
class UserFacingProcessingException extends ProcessingException {
/**
* @param string $message
* @param int $code
* @param \Throwable|null $previous
* @param string|null $userFacingMessage
* @since 33.0.0
*/
public function __construct(
string $message = '',
int $code = 0,
?\Throwable $previous = null,
private ?string $userFacingMessage = null
) {
parent::__construct($message, $code, $previous);
}
/**
* @since 33.0.0
*/
public function getUserFacingMessage(): ?string {
return $this->userFacingMessage;
}
/**
* @param null|string $userFacingMessage Must be already translated into the language of the user
* @since 33.0.0
*/
public function setUserFacingMessage(?string $userFacingMessage): void {
$this->userFacingMessage = $userFacingMessage;
}
}