AnsweredAssumed Answered

idenitifyTask.execute returning results in error callback

Question asked by waringt on Nov 15, 2016


   I am seeing something strange in my IdentifyTask.execute. In the past I have not used the error callback on my IdentifyTask.execute calls just because I've never seen them fail. However, today was different. I set up a identify task on a map service and set up the parameterslike so:


identifyTask = new IdentifyTask("http://domainName/arcgis/rest/services/test/SD/MapServer");
identifyParams = new IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerIds = [4];
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_ALL;
identifyParams.width = map.width;
identifyParams.height = map.height;


However when I called the identifyTask on map click, nothing happened. No error or anything. So I brought in my good friend errorCallback to see what was going on. To my surprise, the error callback reported a beautifully structured response - the one that I had expected to see in in my successCallback instead of an error. And this return was perfectly structured geometry, attributes and everything. It was perfect. Here is what I'm using for the execute task:


function executeIdentifyTask(mapPoint) {
"dojo/on"], function(arrayUtils, on){
console.log("event.mapPoint: " + mapPoint);
identifyParams.geometry = mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams).addCallback(function (response) {
return, function (result) {
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = layerName;
var bgTemplate = new InfoTemplate("", "Name: ${Name}");
return feature;
}, function (error){
console.log("error: " + JSON.stringify(error));

console.log("deferred: " + JSON.stringify(deferred))


Has anyone seen anything like this before? It is driving me crazy. 

Thanks, Tyler