Closed
Description
In #3 we are beginning to add checks for proper parameters and throwing errors if they are unexpected types. Currently we use the following approach:
if (!info[2]->IsFunction())
{
Nan::ThrowTypeError("third arg 'callback' must be a function");
return;
}
In an asynchronous function, this throws instead of returning an error in the callback, which is a super big benefit of a callback function. To avoid this currently, we can wrap async functions in try/catch
statements but that gets a bit clumsy.
How can we better handle errors in the .cpp
& Nan side of things so they are returned as errors instead of thrown?
Metadata
Metadata
Assignees
Labels
No labels