Closed vipulchaursiya closed 3 years ago
From the docs:
Using ES2017 async functions Async accepts async functions wherever we accept a Node-style callback function. However, we do not pass them a callback, and instead use the return value and handle any promise rejections or errors thrown.
async.mapLimit(files, 10, async file => { // <- no callback! const text = await util.promisify(fs.readFile)(dir + file, 'utf8') const body = JSON.parse(text) // <- a parse error here will be caught automatically if (!(await checkValidity(body))) { throw new Error(`${file} has invalid contents`) // <- this error will also be caught } return body // <- return a value! }, (err, contents) => { if (err) throw err console.log(contents) })
We can only detect native async functions, not transpiled versions (e.g. with Babel). Otherwise, you can wrap async functions in async.asyncify().
So when I run this code I'm getting this error TypeError: callback is not a function at C:\Users-USER\github\beusalons\manijment-api\models\Video.js:57:5 at processTicksAndRejections (internal/process/task_queues.js:93:5) all task done
But all things are working fine why I'm getting this error always, for all methods of async js library