Build: SourceMaps not working in error stacktrace

Created on 17 May 2018  路  12Comments  路  Source: dart-lang/build

After upgrading from an older version of Angular 5 alpha / Dart 2 dev releases to the latest one, im not getting source-mapped file paths in my error stack traces (notice the app_component.ddc.js 112:17 ngOnInit):

image

But the funny thing is, everywhere else the sourcemaps are working. For example in the Sources Devtools Tab and even in the underlying stack trace of the console message:

image

These are my specs:

Dart: Dart VM version: 2.0.0-dev.55.0 (Mon May 14 09:23:07 2018 +0200) on "macos_x64"
Build packages:

build 0.12.6
build_config 0.2.6+2
build_modules 0.2.2+4
build_resolvers 0.2.0+2
build_runner 0.8.9
build_test 0.10.2+3
build_web_compilers 0.4.0+1
built_collection 3.1.1
built_value 5.4.4

Angular: 5.0.0-alpha+11
Im on MacOS and using Chrome

needs info

Most helpful comment

I was able to repro this using the example, but the issue wasn't obvious. Currently working full steam ahead on making things Dart2 compatible, and after that I will take another look here.

All 12 comments

I don't quite understand the exact difference to reproduce these two different stack traces, what are the scenarios in which each one is generated? Can you give a minimal repro?

They are from the same error. The first screenshot is the content of the console error that angular (?) prints out. The second screenshot is chromes stacktrace of the console error (you see it when you click the grey triangle in the top left of a console error).

That means that chrome understands the sourcemaps (they also work in the sources panel), but the dart component that prints out the error string (containig the "bad" stacktrace from the first screenshot) does not.

Ok, this does look like its coming from the angular specific ExceptionHandler class which is doing custom logging around stack traces.

@vsmenon was saying he expects the normal toString for stack traces to just do the right thing though.

@matanlurey any ideas here?

Oh one thing @cookiecavekeeper it does look like there is an issue where stack traces don't work if you throw a String specifically, is that what you were throwing? If so can you try throwing a StateError or something like that?

Also can you please attach a minimal repro project so I can test it locally?

I threw a StateError and got the same result. But it seems its rather specific to my project, since I'm having a hard time reproducing it. But ill keep trying

@jakemac53 Nothing on the top of my head, except that some stack traces naturally propagate to the console and others are via window.console.error('$stackTrace').

@jakemac53 Alright, I reduced the project to just a couple of files that still give me the bug:

https://github.com/cookiecavekeeper/angular_dart_stacktraces_bug

I have the same issue with my project running on dart sdk 2.0.0-dev.55.0 on linux

I tested with and without hashLocationStrategy (long shot) on sdk dev.58.0, still not working for me

I was able to repro this using the example, but the issue wasn't obvious. Currently working full steam ahead on making things Dart2 compatible, and after that I will take another look here.

I believe that https://github.com/dart-lang/angular/issues/1367 will fix this issue? @matanlurey does that sound right?

Yes. Lets close this.

Was this page helpful?
0 / 5 - 0 ratings