nl_tokens: Returns a function that handles the response of an arcgis add / update / delete request .
pl_tokens: function handleEsriResponse ( callback ) { return function ( err , response , body ) { var error ; if ( err ) { debug ( 'HTTP request resulted in an error:' , err ) ; return callback ( err ) ; } var json = body && JSON . parse ( body ) ; if ( ! json ) { debug ( 'Response body was null or could not be parsed:' , body ) ; return callback ( new Error ( 'Response body was null or could not be parsed' ) ) ; } debug ( 'Response body as JSON:' , json ) ; // Get the results object from the response, which is the first and only object. // Since batch requests aren't implemented, this should be one of addResults, updateResults, or deleteResults. var results = json [ Object . <mask> ( json ) [ 0 ] ] ; if ( ! results || ! results . length ) { debug ( 'Results object not found or is not as expected:' , results ) ; return callback ( new Error ( 'Results object not found or is not as expected' ) ) ; } // Assume we only get one result back (due to unimplemented batch operations). var result = results [ 0 ] ; if ( result . success ) { debug ( 'Success' ) ; return callback ( null ) ; } else if ( result . error ) { debug ( 'Received error:' , result . error ) ; error = new Error ( result . error . description ) ; error . code = result . error . code ; return callback ( error ) ; } else { debug ( 'Feature service responded with a result that cannot be handled:' , result ) ; error = new Error ( 'Feature service error: unexpected result' ) ; error . result = result ; return callback ( error ) ; } } ; }