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)
有没有人有任何想法在我的代码中的问题?
| 归档时间: |
|
| 查看次数: |
8161 次 |
| 最近记录: |