You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 returns null when I'd have expected to get a specific line in my code. It's possible that the way we are using source_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.
Edit dev tools settings and ensure Enable JavaScript source maps is checked
pub serve
Navigate to localhost:8080 in Chrome
Click the button labeled Throw Exception
Switch to the dev tools Console
You should see the output from us applying the source map followed by Chrome handling the exception and applying the source map itself:
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.
The text was updated successfully, but these errors were encountered:
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. dart-lang/sdk#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.The text was updated successfully, but these errors were encountered: