Closed RReverser closed 1 year ago
To be clear: this is a panic inside rquickjs and not in the user code.
No, this is a panic in my own example code, where I'm unwrapping the result.
Oh I see what you mean; yeah good point. I thought it's in my unwrap, but this makes it even worse.
I have introduced a PR to fix this issue #148.
This will be a significant change to how javascript errors are handled in rquickjs but will allow you to retrieve any thrown javascript value.
In JavaScript, while uncommon, it's possible to throw arbitrary values, not just
Error
objects and some libraries actually make use of it.Right now
rquickjs
doesn't allow to retrieve this non-Error
value and fails with conversion errors instead, as theException
variant can't represent anything but error objects:Example:
results in the following conversion error, with no way to retrieve the original error value:
For compatibility with arbitrary JS code, it should be possible to retrieve the original
rquickjs::Value
from the exception. As far as I can tell, QuickJS provides this functionality, and the conversion is imposed only at the rquickjs level.