As the documentation says: this api is just for rendering the stack, not
for trapping all exceptions that are thrown.

The closest you can currently get to that is --print-all-exceptions, but
that obviously only works locally and just prints the exceptions.

On Thu, Jul 21, 2022 at 10:44 AM theratliter theratliter <
theratli...@gmail.com> wrote:

> Hi all! I have a question about `Error.prepareStackTrace`.  I want to
> collect all stacks of error and do not affect the user. V8 document said
> `the custom prepareStackTrace function is only called once the stack
> property of Error object is accessed`.  And the code as follows works. Does
> this code have any problem ?
> ```
> function test() {
>     Error.prepareStackTrace = (error, stack) => {
>         /*
>           collect the stack here
>         */
>           return error.stack;
>     };
>     const error = new Error();
>     throw error;
> }
> test();
> ```
>
> --
> --
> v8-users mailing list
> v8-users@googlegroups.com
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to v8-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-users/5f735821-a160-402f-a056-d8b422445a42n%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-users/5f735821-a160-402f-a056-d8b422445a42n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/CANS-YRoMGGdzKLFXAFPRczXdBMB89RYmoe-UoSMiLhpuSv-Hdw%40mail.gmail.com.

Reply via email to