Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ddc] Error messages no longer appearing when running apps in Chrome #55893

Open
nshahan opened this issue May 31, 2024 · 1 comment
Open

[ddc] Error messages no longer appearing when running apps in Chrome #55893

nshahan opened this issue May 31, 2024 · 1 comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P3 A lower priority bug or feature request web-dev-compiler

Comments

@nshahan
Copy link
Contributor

nshahan commented May 31, 2024

Chrome recently made a change that broke the printing of our error messages in the console when errors are uncaught.
See: https://chromium-review.googlesource.com/c/v8/v8/+/5378709

In this code I would hope to see the the cast failure message in the console:

confuse(x) => x;

main() {
  confuse('hello') as int;
}

Instead all you get is:

Error
    at Object.throw_ [as throw] (dart_sdk.js:9465:11)
    at Object._failedAsCheck (dart_sdk.js:16610:15)
    at dart_rti.Rti.new._generalAsCheckImplementation (dart_sdk.js:16596:14)
    at dart_rti.Rti.new._installSpecializedAsCheck (dart_sdk.js:16548:24)
    at Object.main (test_01.js:24:17)
    at test_01.html:22:17
    at Object.execCb (require.js:1696:33)
    at Module.check (require.js:883:51)
    at Module.<anonymous> (require.js:1139:34)
    at require.js:134:23
    at require.js:1189:21
    at each (require.js:59:31)
    at Module.emit (require.js:1188:17)
    at Module.check (require.js:938:30)
    at Module.enable (require.js:1176:22)
    at Module.init (require.js:788:26)
    at callGetModule (require.js:1203:63)
    at Object.completeLoad (require.js:1590:21)
    at HTMLScriptElement.onScriptLoad (require.js:1717:29)

If you inspect the error before it gets thrown you can still see .message contains "TypeError: "hello": type 'String' is not a subtype of type 'int'".

To fix this, it seems like we need to pass the message to the Error constructor. Then it appears in the console like it used to.

If you run the same code in firefox the console shows:

Uncaught Error: TypeError: "hello": type 'String' is not a subtype of type 'int'
    DartError file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:10643
    throw_ file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:9465
    _failedAsCheck file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:16610
    _generalAsCheckImplementation file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:16596
    _installSpecializedAsCheck file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:16548
    main file:///Users/nshahan/code/test_files/test_01.js:24
    <anonymous> file:///Users/nshahan/code/test_files/test_01.html:22
    execCb file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1696
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:883
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1139
    bind file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1189
    each file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1188
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:938
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1139
    bind file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1189
    each file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1188
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:938
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1176
    init file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:788
    callGetModule file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1203
    completeLoad file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1590
    onScriptLoad file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1717

This adds additional complications to calls of Error.throwWithStackTrace where the desired stack trace is missing from the message:

fn() => gn();

gn() => hn();

hn() => StackTrace.current;

main() {
  throw Error.throwWithStackTrace('My error message.', fn());
}

Chrome doesn't show the .message from the current getter implementation.

Error
    at Object.createErrorWithStack (dart_sdk.js:9478:12)
    at Error._throw (dart_sdk.js:10964:18)
    at Error.throwWithStackTrace (dart_sdk.js:10961:18)
    at Object.main (test_01.js:33:27)
    at test_01.html:22:17
    at Object.execCb (require.js:1696:33)
    at Module.check (require.js:883:51)
    at Module.<anonymous> (require.js:1139:34)
    at require.js:134:23
    at require.js:1189:21
    at each (require.js:59:31)
    at Module.emit (require.js:1188:17)
    at Module.check (require.js:938:30)
    at Module.<anonymous> (require.js:1139:34)
    at require.js:134:23
    at require.js:1189:21
    at each (require.js:59:31)
    at Module.emit (require.js:1188:17)
    at Module.check (require.js:938:30)
    at Module.enable (require.js:1176:22)
    at Module.init (require.js:788:26)
    at callGetModule (require.js:1203:63)
    at Object.completeLoad (require.js:1590:21)
    at HTMLScriptElement.onScriptLoad (require.js:1717:29)

Firefox shows both like Chrome used to do:

Uncaught Error: My error message.
    get current@file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:128329:30
hn@file:///Users/nshahan/code/test_files/test_01.js:30:5
gn@file:///Users/nshahan/code/test_files/test_01.js:27:20
fn@file:///Users/nshahan/code/test_files/test_01.js:24:20
main@file:///Users/nshahan/code/test_files/test_01.js:33:96
@file:///Users/nshahan/code/test_files/test_01.html:22:17
execCb@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1696:33
check@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:883:51
newContext/enable/</<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1139:34
bind/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134:23
newContext/emit/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1189:23
each@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59:31
emit@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1188:21
check@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:938:30
newContext/enable/</<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1139:34
bind/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134:23
newContext/emit/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1189:23
each@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59:31
emit@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1188:21
check@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:938:30
enable@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1176:22
init@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:788:26
callGetModule@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1203:63
completeLoad@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1590:34
onScriptLoad@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1717:29
EventListener.handleEvent*req.load@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1942:22
load@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1685:21
load@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:834:29
fetch@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:824:66
check@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:856:30
enable@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1176:22
enable@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1557:39
newContext/enable/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1161:33
bind/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134:23
each@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59:31
enable@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1113:21
init@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:788:26
newContext/makeRequire/localRequire/<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1460:36
setTimeout handler*req.nextTick<@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1815:19
localRequire@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1449:29
requirejs@file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1797:24
@file:///Users/nshahan/code/test_files/test_01.html:11:10

    DartError file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:10643
    RethrownDartError file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:10656
    createErrorWithStack file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:9478
    _throw file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:10964
    throwWithStackTrace file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js:10961
    main file:///Users/nshahan/code/test_files/test_01.js:33
    <anonymous> file:///Users/nshahan/code/test_files/test_01.html:22
    execCb file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1696
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:883
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1139
    bind file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1189
    each file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1188
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:938
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1139
    bind file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1189
    each file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59
    emit file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1188
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:938
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1176
    init file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:788
    callGetModule file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1203
    completeLoad file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1590
    onScriptLoad file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1717
    load file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1942
    load file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1685
    load file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:834
    fetch file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:824
    check file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:856
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1176
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1557
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1161
    bind file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:134
    each file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:59
    enable file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1113
    init file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:788
    localRequire file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1460
    setTimeout handler*req.nextTick< file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1815
    localRequire file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1449
    requirejs file:///Users/nshahan/code/dart-sdk/sdk/third_party/requirejs/require.js:1797
    <anonymous> file:///Users/nshahan/code/test_files/test_01.html:11
[dart_sdk.js:10643:7](file:///Users/nshahan/code/dart-sdk/sdk/xcodebuild/ReleaseARM64/gen/utils/ddc/stable/sdk/amd/dart_sdk.js)

​
@nshahan nshahan added P1 A high priority bug; for example, a single project is unusable or has many test failures web-dev-compiler area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. labels May 31, 2024
@nshahan
Copy link
Contributor Author

nshahan commented Jun 28, 2024

A change has landed in Chrome that resolves this issue. This will be available in chrome stable v128 with a possibility of being cherry picked to beta v127.
Chrome issue: https://g-issues.chromium.org/issues/344629939
Fix: https://chromium-review.googlesource.com/c/v8/v8/+/5633534

@nshahan nshahan added P3 A lower priority bug or feature request and removed P1 A high priority bug; for example, a single project is unusable or has many test failures labels Jun 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P3 A lower priority bug or feature request web-dev-compiler
Projects
None yet
Development

No branches or pull requests

1 participant