dmarquardt

error catching in print task

Discussion created by dmarquardt on Feb 24, 2014
Hello,

I'm using printTask and am having trouble breaking out of the print task itself.  While I can identify the error (using the printTask.error event)  I can't seem to stop the overall print function from continuing to run.  My basic setup is:

function createPrintTask () {

  // params =   a bunch of parameters for the different templates.....

  printTask = new esri.tasks.PrintTask(location of print service);
  printTask.execute(params, printResult);

  printTask.on('error', function () {
     alert ("error");
     return;   ////  This is where I'd like to get out of the printTask execution
  }
}

function printResult(result) {
   // handles print result
}

In order to exit,  I've tried using 'break;' and  'return false;' .  What I'd like to happen is that the printTask would stop executing.  Any ideas on how to do this?  What do I need to actually stop: the printTask object, or the createPrintTask function?

David

Outcomes