Catching ProcessEngineException and adding details to the exception

Hello,

This might look like a strange requirement, but I want the failed tasks to be identified with one api call.

ie, I call the jobs api which return the jobs that have an exception message. I intend to parse this JSON and display them in a table.

API

http://192.168.1.188:8080/engine-rest/job?withException=true

I have some script tasks and http-connect task that return a json output with status. I can parse this output and throw an exception if status that I return shows and error.

|exceptionMessage|"Unable to evaluate script: Node not found:5656 in at line number 4 at column

The above was done using javascript

var node_details = nodeid // is a process variable

    if (statusCode != 200) {
    var msg = "Api response not ok "+url+" :"+node_details;
    	throw msg;
    }

    var status = S(response).prop("success").value();
    var msgg = S(response).prop("message").value()+" :"+node_details;

     if (status == "0") throw msgg;

    S(response);

This works fine when there is no connectivity issues to the api server. In case there is a connectivity issue to the api server, process engine throws a “No Route to host” exception.

So my question is; can I catch these Process engine exceptions in the output parameter javascript, append my node details and throw again?

Any advice is appreciated.

Thank you,
Rajiv C.J.

The amount of failed tasks we expect are minimal so I think we can use the instance id from the jobs api and then call the instance api to fetch necessary variables.

Thanks,