From 18f3edda7a9aeaac8d81e2537e7897d6c370a9f9 Mon Sep 17 00:00:00 2001 From: Yash Ladha Date: Sat, 22 Jan 2022 09:37:15 +0530 Subject: [PATCH 1/2] doc: update measure memory rejection information If in case context is unable to allocate a promise then `ERR_CONTEXT_NOT_INITIALIZED` error will be thrown (as promise rejection) in the vm measureMemory call. --- doc/api/vm.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/api/vm.md b/doc/api/vm.md index 6e7e60152c9b11..291a41743bda8f 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1060,8 +1060,9 @@ current V8 isolate, or the main context. exits before the next GC). With eager execution, the GC will be started right away to measure the memory. **Default:** `'default'` -* Returns: {Promise} If the memory is successfully measured the promise will - resolve with an object containing information about the memory usage. +* Returns: {Promise} If the memory is successfully measured, the promise will + resolve with an object containing information about the memory usage, else it + will be rejected with an error with `ERR_CONTEXT_NOT_INITIALIZED` code property. The format of the object that the returned Promise may resolve with is specific to the V8 engine and may change from one version of V8 to the next. From 790b803d7fab20d31d18ba92ddd4461b45af77b6 Mon Sep 17 00:00:00 2001 From: Yash Ladha <18033231+yashLadha@users.noreply.github.com> Date: Sat, 13 May 2023 21:40:29 +0530 Subject: [PATCH 2/2] Update doc/api/vm.md Co-authored-by: Antoine du Hamel --- doc/api/vm.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/vm.md b/doc/api/vm.md index 291a41743bda8f..616215f5d16bdd 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -1061,8 +1061,8 @@ current V8 isolate, or the main context. right away to measure the memory. **Default:** `'default'` * Returns: {Promise} If the memory is successfully measured, the promise will - resolve with an object containing information about the memory usage, else it - will be rejected with an error with `ERR_CONTEXT_NOT_INITIALIZED` code property. + resolve with an object containing information about the memory usage. + Otherwise it will be rejected with an `ERR_CONTEXT_NOT_INITIALIZED` error. The format of the object that the returned Promise may resolve with is specific to the V8 engine and may change from one version of V8 to the next.