Avoid error popups for closed tasks


I have user tasks where users can observe a completion which is triggered by an external condition (a backend sends progress information to camunda which I want to show in the frontend).

The observation task may be completed “automatically” while the user is watching.

By default the frontend detects this, strikes out the form title and displays an error message that the task no longer exists when the user is in the task while it gets completed. I need to close such forms automatically, without showing an error and with no need for manual interaction. Or I need a better way to give feedback about the progress.

I try to use the JavaScript code below to poll the tasklist api for the completion condition and close the form.

$http.get(Uri.appUri('engine://engine/:engine/task/' + camForm.taskId + '/variables'))
                    .success(function (variables) {
                        if(<condition which signifies completion>) {
                                $scope.complete(); // submit task form after user can see completion
                            }, 1000);

                    .error(function (data, status) {
                                $scope.complete(); // submit task form after error
                        }, 0);

But the popups below appear, which makes the user experience very poor.

I guess this happens when the .error handler was triggered:


and this upon .success:


Unfortunately there are no stack traces in the console which would allow me to tell exactly which code raises these popups and why.

What do I have to do so that these popups do not appear? Note that I have a race condition: when I request if the task still exists (to decide if I can ask for its variables) it might get completed just before I ask for the variables.

Related, but unanswered: Task complete shows error screen, how to avoid that?


see Dismissing task form for inexistent task