Skip to content

Unexpected paths in Flutter web error stacks #949

@DanTup

Description

@DanTup

This is similar to #379, though the packages a less weird now - but they're not in the format I would expect. I'm not sure where the problem lies though (webdev, Flutter, or somewhere else - cc @grouma @jonahwilliams).

I've got a simple Flutter app that throws an exception:

https://github.com/Dart-Code/Dart-Code/blob/484ebc5836a73eb8109fcf28f539a9c3c1df5a2a/src/test/test_projects/flutter_hello_world/lib/broken.dart

If I run it with flutter run -d chrome -t lib/broken.dart This is what I get:

══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _Exception was thrown building MyBrokenHomePage(dirty):
Exception: Oops

The relevant error-causing widget was:
  MyBrokenHomePage
  file:///Users/danny/Dev/Dart-Code/src/test/test_projects/flutter_hello_world/lib/broken.dart:34:30

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 195:49  throw_
packages/hello_world/broken.dart 58:5                                         [_throwAnException]
packages/hello_world/broken.dart 53:5                                         build
packages/flutter/src/widgets/framework.dart 4576:28                           build
packages/flutter/src/widgets/framework.dart 4502:15                           performRebuild
packages/flutter/src/widgets/framework.dart 4218:5                            rebuild
packages/flutter/src/widgets/framework.dart 4481:5                            [_firstBuild]
packages/flutter/src/widgets/framework.dart 4476:5                            mount

Everywhere that has packages/ I would expect to see package:. To the client, "packages/hello_world" is a path that doesn't match anything on disk (there is no packages folder on disk, I think this comes from the URL used to serve them to the browser). This means we don't match them up correctly to make the filenames in the stack trace clickable.

(it's probably not difficult for me to do a replacement on packages/ at the start of a line, but other tools/command line users might also be tripped up by this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions