fix: address review comments

Signed-off-by: Marcel Klehr <mklehr@gmx.net>
pull/55713/head
Marcel Klehr 2025-10-20 15:54:10 +07:00
parent 3f527661b1
commit 9df303f876
4 changed files with 13 additions and 2 deletions

@ -1104,7 +1104,9 @@ class Manager implements IManager {
// truncate error message to 1000 characters
$task->setErrorMessage(mb_substr($error, 0, 1000));
// truncate error message to 1000 characters
$task->setUserFacingErrorMessage(mb_substr($userFacingError, 0, 1000));
if ($userFacingError !== null) {
$task->setUserFacingErrorMessage(mb_substr($userFacingError, 0, 1000));
}
$this->logger->warning('A TaskProcessing ' . $task->getTaskTypeId() . ' task with id ' . $id . ' failed with the following message: ' . $error);
} elseif ($result !== null) {
$taskTypes = $this->getAvailableTaskTypes();

@ -10,10 +10,14 @@ declare(strict_types=1);
namespace OCP\TaskProcessing\Exception;
use OCP\AppFramework\Attribute\Consumable;
/**
* Exception thrown during processing of a task
* by a synchronous provider
*
* @since 30.0.0
*/
#[Consumable('30.0.0')]
class ProcessingException extends \RuntimeException {
}

@ -10,6 +10,8 @@ declare(strict_types=1);
namespace OCP\TaskProcessing\Exception;
use OCP\AppFramework\Attribute\Consumable;
/**
* Exception thrown during processing of a task
* by a synchronous provider with the possibility to set a user-facing
@ -17,6 +19,7 @@ namespace OCP\TaskProcessing\Exception;
*
* @since 33.0.0
*/
#[Consumable('33.0.0')]
class UserFacingProcessingException extends ProcessingException {
/**
@ -30,7 +33,7 @@ class UserFacingProcessingException extends ProcessingException {
string $message = '',
int $code = 0,
?\Throwable $previous = null,
private ?string $userFacingMessage = null
private ?string $userFacingMessage = null,
) {
parent::__construct($message, $code, $previous);
}

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace OCP\TaskProcessing;
use OCP\AppFramework\Attribute\Consumable;
use OCP\Files\File;
use OCP\Files\GenericFileException;
use OCP\Files\NotPermittedException;
@ -25,6 +26,7 @@ use OCP\TaskProcessing\Exception\ValidationException;
* without known which providers are installed
* @since 30.0.0
*/
#[Consumable('30.0.0')]
interface IManager {
/**