TypeError:Object#<socket>没有方法'destory'

时间:2016-02-03 17:06:48

标签: node.js sockets destroy

我无法从node.js中的net.createConnection处理ECONNREFUSED错误。

当我连接时,我得到ECONREFUSED(这很好),我这样处理:

" Write toggle switch
let b:write = "no"

function! ToggleWrite()
  if exists("b:write") && b:write == "yes"
    let b:write = "no"
    set nowrap
    set nolinebreak
    set textwidth=100
    set wrapmargin=0
    set nospell
    " ↓↓↓ I want to call this ↓↓↓
    ":Goyo
  else
    let b:write = "yes"
    set wrap
    set linebreak
    set textwidth=100
    set wrapmargin=0
    set spell
    " ↓↓↓ I want to call this ↓↓↓
    ":Goyo 60x100%
  endif
endfunction

" Set up the toggle sequence
nmap  <expr> ,w  ToggleWrite()

然后给出了错误:TypeError:Object#没有方法'destory'。

我的目标是根据错误关闭套接字,然后启动重新连接过程。

提前致谢!

1 个答案:

答案 0 :(得分:0)

您的意思是destroy吗?你拼写错误(distORy