Karthikeya1500 opened a new pull request, #5943:
URL: https://github.com/apache/couchdb/pull/5943

   # QuickJS: fix error reporting in query server
   
   ## Problem
   The QuickJS query server fails to report useful error messages when standard 
JavaScript errors or non-Error objects (like strings) are thrown outside of 
captured sandboxes.
   
   1. **For standard Error objects:** `JSON.stringify(e)` results in an empty 
object `{}`. The client receives `["error", "SomeError", {}]` instead of the 
error details.
   2. **For non-Error objects (e.g., `throw "foo"`):** The server attempts to 
access `e.stack`, which is `undefined` on strings/primitives. This results in 
`["error", "unnamed_error", null]`.
   
   ## Solution
   Use the existing `errstr(e)` utility (already defined in `util.js`) to 
ensure that a descriptive string representation of the error is sent back to 
the client. This brings the QuickJS implementation in line with the 
SpiderMonkey behavior in `loop.js` and other parts of the codebase.
   
   ## Testing
   Verified that `errstr(e)` correctly identifies and stringifies both standard 
`Error` instances and primitive values thrown by user 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]

Reply via email to