One of the reason why this error occurs during test but not on other methods is related to how we call cb() of fileFilter option/function when we are rejecting certain file.
The above error was thrown when fileFilter is passed and inside it the callback is returned as:
cb(new Error("some error msg");
but not when callback is returned as:
cb(null, false);
What is missing in the documentation?
The right way to pass cb() for custom error is the following:
cb(null, false, new Error("some error msg"))
What should be added in the documentation and where?
// If you want to reject a file with custom error:
cb(null, false, new Error("some error msg"))
ECONNRESET during test only
What is causing the error?
One of the reason why this error occurs during test but not on other methods is related to how we call
cb()
of fileFilter option/function when we are rejecting certain file.The above error was thrown when
fileFilter
is passed and inside it the callback is returned as:but not when callback is returned as:
What is missing in the documentation?
The right way to pass
cb()
for custom error is the following:What should be added in the documentation and where?
The above line should be appended in the fileFilter option description
It would be better to append it below the line which shows how to reject a file.