Detect timeout

Discussion created by dhunink on Jan 26, 2014
Hi There,

I have a code snippet that fires the ArcGIS printTask(). Most of the times everything works like a charm. But once a while, it results in a 504 (timeout). Unfortunately, the prinTask() doesn't fire the regular the regular error function the, So i'm looking for a way to detect the occurrence of the 504. Or if anyone knows how to prevent it from occurring at all, that would be most wonderful. But since I doubt if that's possible, let's narrow the question down to:
How to detect the prinTask() resulting in a 504 error, so we could show an notification to the user?

Here's the snippet, a screenshot of the 504 in the console is also attached:

[HTML]//The if/else below is needed to prevent IE caching problem
if (graphicsLayer.loaded) {
printTask.execute(params, printResult, printError);
}else {
dojo.connect(map, "onUpdateEnd", function(){
      printTask.execute(params, printResult, printError);
[HTML]function printError(errorDetails){
$('#progressMessages ul li#progress').html('<strong>Fout opgetreden</strong> tijdens stap. Wanneer u dit probleem meerdere keren ervaart vragen wij u de beheerder op de hoogte te stellen via de \'feedback\' knop links en de volgende error details te vermelden: <br/><strong>Error details</strong>: '+errorDetails).removeClass('progressBusy').addClass('progressFailed');