CoffeeScript编译:意外的IF

Tec*_*oCF 7 javascript coffeescript

我正在为API编写一些CoffeeScript代码,在我的代码的错误捕获部分中,我放置了一个IF语句.现在,在编译过程中,CoffeeScript说IF语句是意外的.

#  Handle Errors
app.error (err, req, res, next) ->
    if err instanceof NotFound
        res.send '404, not found.'
    else
        res.send '500, internal server error.'

app.get '/*', (req, res) ->
    throw new NotFound

NotFound = (msg) ->
    this.name = 'NotFound'
    Error.call this, msg
    Error.captureStackTrace this, arguments.callee
Run Code Online (Sandbox Code Playgroud)

错误是

/home/techno/node/snaprss/application.coffee:22:5: error: unexpected if
    if err instanceOf NotFound
    ^^
Run Code Online (Sandbox Code Playgroud)

有没有人有任何想法在我的代码中的问题?

dnl*_*lkv 8

CoffeeScript示例代码中出现意外的'INDENT'

这个问题看起来有点类似.

因此,请考虑检查编辑器中的选项卡和空格.