[web] Improve error messages in Future.toJS #56898
Labels
area-web
Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop.
type-enhancement
A request for a change that isn't a bug
web-js-interop
Issues that impact all js interop
The current implementation of
Future.toJS
(here, here) handles errors coming from the Dart future by rejecting a JS Promise.This is great so JS code knows that something failed within Dart, but the debugging experience of what happened is not great, because the error text is hardcoded to:
As a JS programmer, I find it odd that I need to unbox objects contained in the emitted error, instead of having a textual description of what's wrong.
In the Flutter engine we're trying something like this, but it'd be nice to have a
Future.toJS
that exposes the "text" of the underlying error directly in the JS console, so we can stop using a bespoke solution.The text was updated successfully, but these errors were encountered: