Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/bug: Reject when function is async but not done called nor Promise returned #19

Closed
tunnckoCore opened this issue Apr 3, 2017 · 1 comment

Comments

@tunnckoCore
Copy link
Member

tunnckoCore commented Apr 3, 2017

Almost the same as #18

if (isAsyncFn && !called && !isPromise(syncResult)) {
  var msg = 'async function need to call `done/cb` callback argument or return a Promise'
  reject(new Error('redolent: ' + msg))
}

for example

var fn = redolent(function (foo, done) {
  console.log('foo is', foo)
  // done is not called nor Promise is returned,
  // so when `fn` is called it will return rejected promise 
})

fn(123).catch(console.log)
@tunnckoCore
Copy link
Member Author

Not so easy and probably is tricky.

But another thing is found. Should return rejected error when done is not called but returns a non Promise value (it can return and return undefined)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant