Repository navigation
Use JSON.stringify for test tracing output - #28119
jeremy-code wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the tracing logic in src/lib/libtrace.js to serialize the entry object using JSON.stringify when logging. The review feedback correctly points out that JSON.stringify can throw a TypeError if entry contains BigInt values, which are common in Emscripten environments. It is recommended to handle this potential error by wrapping the serialization in a try...catch block or using a custom replacer to safely serialize BigInt values.
sbc100
left a comment
There was a problem hiding this comment.
Its been a while since I heard of anyone actually using this API. Can I ask what you are using it for?
lgtm % comment
| ); | ||
| } catch (e) { | ||
| out('Tracing [Serialization Error]: ' + e.message); | ||
| } |
There was a problem hiding this comment.
Might be easier to read this error if you just let the exception flow to the top level? i.e. just remove this try/catch?
There was a problem hiding this comment.
That makes sense -- implemented
I'm using embind and I want to verify that the memory allocated by the generated code is correctly being freed. I figured the worker setup would be too complicated since it's just quick sanity checking. |
Currently, it outputs something like this for objects: