From fd84de572176609c69e9c311deb6ab059734955d Mon Sep 17 00:00:00 2001 From: Lukas Schaefer Date: Thu, 16 Jul 2026 16:19:21 -0400 Subject: [PATCH 1/3] feat: support user_facing_error_messages for report result for task Signed-off-by: Lukas Schaefer --- nc_py_api/ex_app/providers/task_processing.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nc_py_api/ex_app/providers/task_processing.py b/nc_py_api/ex_app/providers/task_processing.py index 8f5a54eb..ae988f62 100644 --- a/nc_py_api/ex_app/providers/task_processing.py +++ b/nc_py_api/ex_app/providers/task_processing.py @@ -186,13 +186,14 @@ def report_result( task_id: int, output: dict[str, typing.Any] | None = None, error_message: str | None = None, + user_facing_error_message: str | None = None, ) -> dict[str, typing.Any]: """Report result of the task processing to Nextcloud.""" with contextlib.suppress(NextcloudException): if r := self._session.ocs( "POST", f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result", - json={"taskId": task_id, "output": output, "errorMessage": error_message}, + json={"taskId": task_id, "output": output, "errorMessage": error_message, "userFacingErrorMessage": user_facing_error_message}, ): return r return {} @@ -283,13 +284,14 @@ async def report_result( task_id: int, output: dict[str, typing.Any] | None = None, error_message: str | None = None, + user_facing_error_message: str | None = None, ) -> dict[str, typing.Any]: """Report result of the task processing to Nextcloud.""" with contextlib.suppress(NextcloudException): if r := await self._session.ocs( "POST", f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result", - json={"taskId": task_id, "output": output, "errorMessage": error_message}, + json={"taskId": task_id, "output": output, "errorMessage": error_message, "userFacingErrorMessage": user_facing_error_message}, ): return r return {} From f34ee87fc33860d52f2325ba709507ed7ec5436c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 16 Jul 2026 20:24:22 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- nc_py_api/ex_app/providers/task_processing.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nc_py_api/ex_app/providers/task_processing.py b/nc_py_api/ex_app/providers/task_processing.py index ae988f62..0d2d2ad3 100644 --- a/nc_py_api/ex_app/providers/task_processing.py +++ b/nc_py_api/ex_app/providers/task_processing.py @@ -193,7 +193,12 @@ def report_result( if r := self._session.ocs( "POST", f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result", - json={"taskId": task_id, "output": output, "errorMessage": error_message, "userFacingErrorMessage": user_facing_error_message}, + json={ + "taskId": task_id, + "output": output, + "errorMessage": error_message, + "userFacingErrorMessage": user_facing_error_message, + }, ): return r return {} @@ -291,7 +296,12 @@ async def report_result( if r := await self._session.ocs( "POST", f"/ocs/v2.php/taskprocessing/tasks_provider/{task_id}/result", - json={"taskId": task_id, "output": output, "errorMessage": error_message, "userFacingErrorMessage": user_facing_error_message}, + json={ + "taskId": task_id, + "output": output, + "errorMessage": error_message, + "userFacingErrorMessage": user_facing_error_message, + }, ): return r return {} From 19794ae3473f2faae5657e4c7d87c3dde033d3c3 Mon Sep 17 00:00:00 2001 From: Lukas Schaefer Date: Mon, 20 Jul 2026 09:30:10 -0400 Subject: [PATCH 3/3] add docstring Signed-off-by: Lukas Schaefer --- nc_py_api/ex_app/providers/task_processing.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/nc_py_api/ex_app/providers/task_processing.py b/nc_py_api/ex_app/providers/task_processing.py index 0d2d2ad3..bb92fc53 100644 --- a/nc_py_api/ex_app/providers/task_processing.py +++ b/nc_py_api/ex_app/providers/task_processing.py @@ -188,7 +188,12 @@ def report_result( error_message: str | None = None, user_facing_error_message: str | None = None, ) -> dict[str, typing.Any]: - """Report result of the task processing to Nextcloud.""" + """Report result of the task processing to Nextcloud. + + :param error_message: Technical/debug message for administrators. + :param user_facing_error_message: Message shown to the end user when the task failed. + Available starting with Nextcloud 33. + """ with contextlib.suppress(NextcloudException): if r := self._session.ocs( "POST", @@ -291,7 +296,12 @@ async def report_result( error_message: str | None = None, user_facing_error_message: str | None = None, ) -> dict[str, typing.Any]: - """Report result of the task processing to Nextcloud.""" + """Report result of the task processing to Nextcloud. + + :param error_message: Technical/debug message for administrators. + :param user_facing_error_message: Message shown to the end user when the task failed. + Available starting with Nextcloud 33. + """ with contextlib.suppress(NextcloudException): if r := await self._session.ocs( "POST",