             sendResponse null, result
           else            
             sendResponse result
+      
+      req.on 'error', (err) ->
+        result =
+          code: err.code
+          errno: err.errno
+          msg: err.message
+        return sendResponse result
+      
       req.write @_generatePostData(msg)
       req.end()
     catch err

      return cb err if err
      cb null, response
    
    #url = @_getServiceUrl msg
    http_options = 
      host: @_getServiceHost()
      port: @options.port

      sendResponse result
    
    try
      req = http.request http_options, (res) =>        
        res.setEncoding 'utf8'
        body = ''
        res.on 'data', (chunk) ->
          body += chunk
        res.on 'end', () =>
          result =
            code: res.statusCode
            status: 'FAILED'
