jakejs / jake

JavaScript build tool, similar to Make or Rake. Built to work with Node.js.
http://jakejs.com
Apache License 2.0
1.97k stars 190 forks source link

Error handling isn't really working #342

Open etki opened 6 years ago

etki commented 6 years ago

Given following Jakefile:

namespace('lint', function () {
  task('standard', {async: true}, function () {
    setTimeout(fail, 1)
  })
})

task('lint', {async: true}, function () {
  var task = jake.Task['lint:standard']
  task.addListener('error', function () {
    console.log('error intercepted')
  })
  task.invoke()
})

I expect to intercept lint:standard error in lint, however, this doesn't happen:

jake aborted.
Error
    at Timeout.api.fail [as _onTimeout] (/.../node_modules/jake/lib/api.js:350:13)
    at ontimeout (timers.js:386:14)
(See full trace by running task with --trace)