0

I'm using the ArcGIS JavaScript API 3.18.

The print service is configured to be async, with a timeout of 10 minutes.

The code to call the job is as follows:

  printTask.execute(printParameters,
      function (result) {
          $log.debug('Esri portion of print task complete...');
          var exportedMapUrl = result.url;
          onComplete({ url: exportedMapUrl });
      },
      function (errorResult) {
          $log.info(errorResult);
          onError({ message: errorResult, details: [] });
      });
  });

If I intentionally cause an error, i.e. by disabling the print service, the error callback is triggered and all is good, however if I execute a complex print task, which takes >10 minutes (that's another story) and the task times out, nothing is triggered. i.e. if I look in the network tab of Chrome dev tools, I can see that the arcgis api is polling every second or so, and eventually the status jobStatus:"esriJobFailed" is returned, however this seems to be eaten by the arcgis api, and nothing is raised in my code - how can I trap a timeout? This seems to be a pretty fundamental "error" that just disappears and it's difficult for me to surface this to the user.

Edit

This is just using the standard print service, with slightly modified templates. The process succeeds when A4, A3 & A1 are selected, and also when a less complex A0 map is printed (i.e. less layers).

3 Answers 3

1

Your error callback should fire in the event of the GP task failing...Have you verified that the GP Service works and that you matched the required parameters of the PrintTask in the GP Tool (I only ask because I know it is very picky)? Checking the ArcGIS Server log files should show what is actually throwing the error in the back end.

As for the JS side of things, one thing you could try is to hook into the complete and error events:

// on is 'dojo/on'
var pt = printTask.execute(printParameters);

on(pt, 'complete', function(dataFile){
  // do something with dataFile such as download link
});

on(pt, 'error', function(error){
  $log.info(errorResult);
  console.log('error: ', error);
});
3
  • I just added some points to my question - i.e. it succeeds with A4, A3 & A1, and a less complex A0 map. Therefor I don't believe there is a problem with the parameters. It appears that the service timing out is not actually treated as the task "failing". I'll attempt to hook in to the error event to see if it is triggered.
    – hitch
    Commented Feb 9, 2017 at 3:28
  • adding code to handle the error event made no difference - it also wasn't executed.
    – hitch
    Commented Feb 9, 2017 at 3:40
  • Hmm, that is weird. It is starting to sound like some sort of time out as you were suspecting, I've never encountered that before.
    – crmackey
    Commented Feb 9, 2017 at 4:09
-1

try esriConfig.defaults.io.timeout. By default is 60 secs

2
  • Welcome to GIS SE! As a new user please take the tour to learn about our focused Question and Answer format. Please edit your answer to include more detail about your suggested answer - how/where to use it, and what it does. One-line answers that don't include explanations may be deleted.
    – Midavalo
    Commented Feb 15, 2017 at 17:45
  • As noted in my original question, the tasks times out after 10 minutes, so I don't think it's a 60 second timeout causing issues.
    – hitch
    Commented Feb 15, 2017 at 22:14
-1

esriConfig.defaults.io.timeout = 100000;

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.