From 984d81c85718524f58f894062bef609b3bef207b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=20/=20green?= Date: Fri, 6 Oct 2023 16:22:23 +0900 Subject: [PATCH] fixup! add comment to handleErrorFromBinding Co-authored-by: Joyee Cheung --- lib/internal/fs/promises.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/fs/promises.js b/lib/internal/fs/promises.js index 8ef30fee8ef327..33260474ea2f10 100644 --- a/lib/internal/fs/promises.js +++ b/lib/internal/fs/promises.js @@ -131,6 +131,10 @@ function lazyFsStreams() { return fsStreams ??= require('internal/fs/streams'); } +// By the time the C++ land creates an error for a promise rejection (likely from a +// libuv callback), there is already no JS frames on the stack. So we need to +// wait until V8 resumes execution back to JS land before we have enough information +// to re-capture the stack trace. function handleErrorFromBinding(error) { ErrorCaptureStackTrace(error, handleErrorFromBinding); return PromiseReject(error);