loop of geoprocessing tasks, skip the error?

563
2
Jump to solution
01-23-2020 02:42 PM
LefterisKoumis
Occasional Contributor III

I'm running a loop of geoprocessing tasks and save them in an array

promisesSeg.push(this.gpSegment_from_PM.execute(params_segment));

When all geoprocessing tasks are completed then it continue on...

 Promise.all(promisesSeg).then(function (results) {
-------
---------

However, if one set of params lead to a geoprocessing error, it creates an error and terminates further processing.

Is there a way to by-pass the error and continue on with the rest of the sets of params?

Hope it makes sense.

0 Kudos
1 Solution

Accepted Solutions
LefterisKoumis
Occasional Contributor III

THank you. Actually, I had to re-think the process and remove the promises. Since I was using a sync geoprocessing opeation which is already a deferred action, I didn't the need the promise. It is a lot simpler to catch errors.

View solution in original post

0 Kudos
2 Replies
DavidPike
MVP Frequent Contributor

Hi,

I dont know if I'm misinterpreting the question so apologies if this obvious.

Try:

    Run your iteration

Except:

    continue

0 Kudos
LefterisKoumis
Occasional Contributor III

THank you. Actually, I had to re-think the process and remove the promises. Since I was using a sync geoprocessing opeation which is already a deferred action, I didn't the need the promise. It is a lot simpler to catch errors.

0 Kudos