ekibun / flutter_qjs

A quickjs engine for flutter.
https://pub.dev/packages/flutter_qjs
MIT License
146 stars 28 forks source link

Custom JS error properties are lost #43

Open Matthiee opened 5 months ago

Matthiee commented 5 months ago

Given the following JS Error

class MyCustomError extends Error { 
  constructor(status, message) 
  { 
    super(message); 
    this.status = status; 
  } 
}

If this error is thrown from inside a QJS script, the status property will be lost.

try {
   qjs.evaluate('throw new MyCustomError(1234, "Oops");');
} catch (e) {
   // status property is lost
   print(e);
}