6f090565aa
According to the [Window.onerror MDN docs][1] an error object may be provided as a 5th argument. This error object can be used to extract a stack trace with more context about the error message. [1]: https://developer.mozilla.org/en-US/docs/Web/API/Window/error_event With this change, we can get a more precise error on uncuaght exceptions. This is an example of a before and after on a unit test failing in ddc-chrome-linux. Before: ``` Runtime window.onerror: window.onerror called: http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:5082: Uncaught Error ``` After: ``` Runtime window.onerror: window.onerror called: http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:5082: Uncaught Error Error: Expected a value of type 'FutureOr<FileSystem>?', but got one of type 'LegacyJavaScriptObject' at Object.throw_ [as throw] (http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:5082:11) at Object.castError (http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:5041:15) at Object.cast [as as] (http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:5385:19) at dart.NullableType.new.as (http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:7243:60) at _AsyncCompleter.new.complete (http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:31216:28) at http://127.0.0.1:46235/root_build/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:99073:19 ``` Change-Id: If89c253d8e6edee9b7102269466b40b605951a6c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/328804 Reviewed-by: Nicholas Shahan <nshahan@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>