I am creating a webApi to trigger a!completeTask(). If this encounters an error, I return an httpResponse to indicate such.
The question is: how do I know what the error was? Is there some way to return the task completion error in the webApi?
Thank you.
a!completeTask( taskId: ri!taskId, taskInputs: { someData: "abc", moreData: "def" }, onSuccess: a!httpResponse(200, {}, "Success") onError: a!httpResponse(500, {}, "What was the error??") )
Discussion posts and replies are publicly visible
Smart services do not expose internal system error details directly in the onError. Custom error messages must be handled by performing validations before calling the smart service. If validation fails, you can return specific error details. You have to rely on logs.
I thought that would be the answer. The most obvious scenario is the task id is wrong.... which we can confirm before calling completeTask.... I wasn't sure what other reason might cause completeTask to fail.
There are couple of scenarios you can pre-validate like, Task Already completed, User lacks permission, required task inputs are missing or invalid, process instance cancelled or terminated and task assigned to different user.