diff --git a/nc_py_api/ex_app/providers/task_processing.py b/nc_py_api/ex_app/providers/task_processing.py index 8f5a54eb..bb92fc53 100644 --- a/nc_py_api/ex_app/providers/task_processing.py +++ b/nc_py_api/ex_app/providers/task_processing.py @@ -186,13 +186,24 @@ 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.""" + """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", 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 +294,24 @@ 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.""" + """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", 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 {}