590b656877
This updates JS exception catching as discussed in #55481: - Only catch JS exceptions when the exception type is `dynamic`, `Object`, or an extension of `JSValue`. (nullable or not) (Previously we also caught JS exceptions when the type is `Error`.) - When the JS value caught in Wasm is `null` or `undefined`, box it as a non-interop class. For compatibility with dart2js, this class is copied from dart2js and has the same `toString` as the dart2js class. - In other cases: box the JS values as `JSValue`. This means the value can be passed as any of the interop types, and can be passed back to JS without manual jsification. Fixes #55481. Issue: https://github.com/dart-lang/sdk/issues/55481 Change-Id: I23e73074729f740b90df2ca8b3c713fb39966556 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/479640 Reviewed-by: Srujan Gaddam <srujzs@google.com> Reviewed-by: Martin Kustermann <kustermann@google.com> Commit-Queue: Ömer Ağacan <omersa@google.com>