2 ms·
I'm not sure I understand the distinction. Right now if you throw an exception inside an async function, that "cancels" it and the function's object references
by noduerme 5y ago
I'm not sure I understand the distinction. Right now if you throw an exception inside an async function, that "cancels" it and the function's object references are eventually GC'd. You catch the exception outside the promise. I'd imagine external cancellations would work in a similar way. Why is it unsafe for something outside to tell the async function to just throw an exception now, halt and dump its object references? If you're planning on explicitly doing it you'd need to catch it anyway. The difference is being able to do it from outside once the async function is running.