flutter_qjs icon indicating copy to clipboard operation
flutter_qjs copied to clipboard

Custom JS error properties are lost

Open Matthiee opened this issue 8 months ago • 0 comments

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);
}

Matthiee avatar Jun 03 '24 08:06 Matthiee