sample/basic/service-example.js
function (error, response) {
            // Destroy the client - frees up resources so that the application
            // stops running
            client.destroy()
            // Display the contents of an error, if one occurred
            if (error) {
              console.log('Request error: ' + error.message)
              // The 'code' property, if set, typically has a string
              // representation of the error code.
              if (error.code) {
                console.log('Request error code: ' + error.code)
              // If no string representation is available for the error code
              // but the error is a DXL 'RequestError', a numeric error
              // code should be available in the
              // 'dxlErrorResponse.errorCode' property.
              } else if (error.dxlErrorResponse) {
                console.log('Request error code: ' +
                  error.dxlErrorResponse.errorCode)
              }
            // No error occurred, so extract information from the response. The
            // toString() call converts the payload from a binary Buffer into a
            // string, decoded using UTF-8 character encoding.
            } else {
              console.log('Client received response payload: ' +
                response.payload.toString())
            }
          }
function (error, response) {
            // Destroy the client - frees up resources so that the application
            // stops running
            client.destroy()
            // Display the contents of an error, if one occurred
            if (error) {
              console.log('Request error: ' + error.message)
              // The 'code' property, if set, typically has a string
              // representation of the error code.
              if (error.code) {
                console.log('Request error code: ' + error.code)
              // If no string representation is available for the error code
              // but the error is a DXL 'RequestError', a numeric error
              // code should be available in the
              // 'dxlErrorResponse.errorCode' property.
              } else if (error.dxlErrorResponse) {
                console.log('Request error code: ' +
                  error.dxlErrorResponse.errorCode)
              }
            // No error occurred, so extract information from the response. The
            // toString() call converts the payload from a binary Buffer into a
            // string, decoded using UTF-8 character encoding.
            } else {
              console.log('Client received response payload: ' +
                response.payload.toString())
            }
          }
function ( error , response ) { // Destroy the client - frees up resources so that the application // stops running client . destroy ( ) // Display the contents of an error, if one occurred if ( error ) { console . log ( 'Request error: ' + error . message ) // The 'code' property, if set, typically has a string // representation of the error code. if ( error . code ) { console . log ( 'Request error code: ' + error . code ) // If no string representation is available for the error code // but the error is a DXL 'RequestError', a numeric error // code should be available in the // 'dxlErrorResponse.errorCode' property. } else if ( error . dxlErrorResponse ) { console . log ( 'Request error code: ' + error . dxlErrorResponse . errorCode ) } // No error occurred, so extract information from the response. The // toString() call converts the payload from a binary Buffer into a // string, decoded using UTF-8 character encoding. } else { console . log ( 'Client received response payload: ' + response . payload . toString ( ) ) } }
Handle the response to the request
Handle the response to the request