Open todbachman-wf opened 8 years ago
FYI -- I've submitted a separate issue to the Dart SDK because it appears line numbers reported by Chrome in stack traces don't line up with the correct locations in source files. https://github.com/dart-lang/sdk/issues/27600 I suppose it's possible the two issues could be related.
We are having trouble with the reliability of applying source maps to stack traces. One of the things I'm finding is
Mapping.spanFor
sometimes returnsnull
when I'd have expected to get a specific line in my code. It's possible that the way we are usingsource_maps
is at fault, so if that's the case please let me know!Here's a simple example that demonstrates the problem. It renders a single button that throws an exception when clicked. It catches the exception and applies the source map to the exception and then rethrows the exception so we can let Chrome handle it too.
pubspec.yaml:
web/index.html:
web/main.dart
lib/stack_trace_parser.dart:
Steps to generate stack traces:
Enable JavaScript source maps
is checkedpub serve
localhost:8080
in ChromeThrow Exception
Notice that our output differs on the second line of the stack trace from that of Chrome. In our case
Mapping.spanFor
returned null and we just passed the stack trace frame through unchanged. On the other hand, Chrome was able to use the source map to identify a line number in the original source file, main.dart (although the actual line number is off by two 😉 ).Am I using the
source_maps
API correctly? If so, it seems like there might be an issue here in the source map parser.