Closed mmomtchev closed 3 years ago
In fact, some standard libraries do exhibit the same behaviour... ok, maybe this will stay like this for the time being
I think this behavior is valid - if the error is with arguments and not execution of work it should be thrown in the main thread, since it is the main threads problem for invoking with invalid arguments.
If an error is detected during the parsing of the arguments phase (the synchronous phase), the raster async functions with throw a synchronous error when called with a callback (as opposed to Promise). I/O errors are reported via the callback and the Promisified-versions work as they should - by rejecting the Promise whether the error is during the synchronous or the asynchronous phase.
The callback versions should report errors only through the callback as it is the norm in all standard Node.js libraries