neo-async icon indicating copy to clipboard operation
neo-async copied to clipboard

neo-async/async.js:throwError doesnt display very useful error for all cases.

Open hiraditya opened this issue 4 years ago • 5 comments

neo-async/async.js has the throwError function which is called several times. It will help if this function takes a parameter and shows exactly what error was there.

  15   var throwError = function throwError() {
  16     throw new Error('Callback was already called.');
  17   };

Example, in the following snippet same function is used for different errors.

3828       return function(err, res) {
3829         if (index === null) {
3830           throwError();
3831         }
3832         if (err) {
3833           index = null;
3834           iterate = noop;
3835           callback = once(callback);
3836           callback(err, createArray(result));
3837           return;
3838         }
3839         result[index] = res;
3840         index = null;
3841         if (++completed === size) {
3842           iterate = throwError;
3843           callback(null, result);
3844           callback = throwError;
3845         } else if (sync) {
3846           nextTick(iterate);
3847         } else {

I'm getting the following error but I cant figure out the call stack, if the error message were helpful that'd be great.

Error: Callback was already called.
    at throwError (/home/node_modules/neo-async/async.js:16:11)
    at /home/node_modules/neo-async/async.js:2818:7
    at processTicksAndRejections (internal/process/task_queues.js:79:11)

hiraditya avatar Mar 15 '20 02:03 hiraditya

@hiraditya Thanks for the issue! Bluebird and Aigle have the longStackTrace feature, so it should be doable. But it could affect performance, I will investigate it carefully.

suguru03 avatar Mar 16 '20 17:03 suguru03

Hello, is there any update on this issue?

ahmad-reza619 avatar Jan 12 '21 05:01 ahmad-reza619

I'm having the same problem and can't figure out any solution. Anyone?

Artofaj avatar Feb 18 '21 20:02 Artofaj

I've had this issue when using Windows because the path of my folder where I entered was in lower case when the correct name is upper case. It worked when I entered the correct path.

Explanations:

cd myfolder/ npm run build » Error: Callback was already called. cd .. cd MYFOLDER/ npm run build » SUCCESS

Aymkdn avatar Oct 11 '21 16:10 Aymkdn

I've had this issue when using Windows because the path of my folder where I entered was in lower case when the correct name is upper case. It worked when I entered the correct path.

Explanations:

cd myfolder/ npm run build » Error: Callback was already called. cd .. cd MYFOLDER/ npm run build » SUCCESS

This fixed my issue. I was not able to build with Vue CLI.

codigoisaac avatar May 24 '22 00:05 codigoisaac