davsclaus opened a new pull request, #28392:
URL: https://github.com/apache/camel/pull/28392
## Summary
_Claude Code on behalf of davsclaus_
A camel-quickjs script whose result cannot reach Java returned the result of
the previous evaluation on the same engine, without an error. For example, `({
big: 1n })` returned `5` when the script before it returned `5`. This happened
for:
- a `BigInt`, also nested or in a `BigInt64Array`
- a cyclic object
- a `toJSON` that throws
- a `Promise` that is rejected
QuickJS4J hands the result to Java in a promise callback, after the script
function has returned. When the `JSON.stringify` of that callback throws, or
the promise is rejected, the rejection is dropped, and the engine kept the
result of the previous call.
The script function now forgets its result once Java reads it. An evaluation
that gives no result fails with an `ExpressionEvaluationException`: "The script
gave no result: its result cannot be turned into JSON (a BigInt, a cyclic
object or a toJSON that throws), or it is a Promise that was rejected". A
`Promise` that resolves still gives its value.
This PR is stacked on #28391, which changes the same files.
## Test plan
- [x] `QuickjsSerializationTest` checks each case after an evaluation that
returned `5`. Its 2 changed tests fail without the fix.
- [x] The camel-quickjs tests pass (67).
- [x] The quickjs doc page and its catalog copy are updated and equal.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]