To enable support for stack traces within applications using QuickJS, it would be ideal to support some form of the non-standard Error.prepareStackTrace API.
I have a fork of QuickJS where I am using this, you can re-use the implementation from there if desired: TooTallNate/quickjs@29339cc