-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
feat(TaskProcessing): user-facing error messages #55713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marcelklehr
merged 12 commits into
master
from
feat/taskprocessing/user-facing-error-message
Oct 30, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7373f11
feat(TaskProcessing): user-facing error messages
marcelklehr e12c0ed
test(TaskProcessing): Add test for user-facing error messages
marcelklehr 97943ce
fix(TaskProcessing): Update openapi descriptions for user-facing erro…
marcelklehr 86316f7
fix(TaskProcessing): Update autoloaders
marcelklehr 8cf1504
fix: Apply suggestion from @kyteinsky
marcelklehr 3f52766
fix: Create new class instead of extending existing class
marcelklehr 9df303f
fix: address review comments
marcelklehr 3ee6999
fix: Use substr to cut error messages
marcelklehr d04d575
Merge branch 'master' into feat/taskprocessing/user-facing-error-message
marcelklehr 1c33239
fix: autoloaderchecker
marcelklehr 8207afb
fix: Use UserFacingProcessingException properly in tests
marcelklehr b5f057c
fix: Fix psalm issue
marcelklehr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| /** | ||
| * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| namespace OC\Core\Migrations; | ||
|
|
||
| use Closure; | ||
| use OCP\DB\ISchemaWrapper; | ||
| use OCP\DB\Types; | ||
| use OCP\Migration\Attributes\AddColumn; | ||
| use OCP\Migration\Attributes\ColumnType; | ||
| use OCP\Migration\IOutput; | ||
| use OCP\Migration\SimpleMigrationStep; | ||
|
|
||
| /** | ||
| * | ||
| */ | ||
| #[AddColumn(table: 'taskprocessing_tasks', name: 'user_facing_error_message', type: ColumnType::STRING)] | ||
| class Version33000Date20251013110519 extends SimpleMigrationStep { | ||
|
|
||
| /** | ||
| * @param IOutput $output | ||
| * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` | ||
| * @param array $options | ||
| * @return null|ISchemaWrapper | ||
| */ | ||
| public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { | ||
| /** @var ISchemaWrapper $schema */ | ||
| $schema = $schemaClosure(); | ||
|
|
||
| if ($schema->hasTable('taskprocessing_tasks')) { | ||
| $table = $schema->getTable('taskprocessing_tasks'); | ||
| if (!$table->hasColumn('user_facing_error_message')) { | ||
| $table->addColumn('user_facing_error_message', Types::STRING, [ | ||
| 'notnull' => false, | ||
| 'length' => 4000, | ||
| ]); | ||
| return $schema; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
lib/public/TaskProcessing/Exception/UserFacingProcessingException.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| <?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; | ||
|
|
||
| use OCP\AppFramework\Attribute\Consumable; | ||
|
|
||
| /** | ||
| * 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 | ||
| */ | ||
| #[Consumable(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; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.