mirror of
https://github.com/nextcloud/server.git
synced 2026-03-22 18:33:46 -04:00
53 lines
1.1 KiB
PHP
53 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;
|
||
|
|
}
|
||
|
|
}
|