New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 780819 link

Starred by 3 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue v8:6513


Previous locations:
v8:7013


Sign in to add a comment

Feature Request: show relative path to module in UnresolvableExport error

Reported by g...@gopositron.com, Oct 28 2017

Issue description

while migrating a large project to ESM from require it can be very confusing to see

`The requested module does not provide an export named 'default'`

but not know which module that is in hundreds of files.

solution:

`The requested module "relative path here" does not provide an export named 'whatever'`
 
Blocking: 6513
Cc: gsat...@chromium.org
Components: Language
Labels: Priority-2
Owner: neis@chromium.org
Status: Assigned (was: Untriaged)

Comment 2 by neis@chromium.org, Nov 2 2017

Labels: HW-All OS-All

Comment 3 by neis@chromium.org, Nov 2 2017

Project: chromium
Moved issue v8:7013 to now be  issue chromium:780819 .

Comment 4 by neis@chromium.org, Nov 2 2017

Components: Blink>JavaScript>Language Blink>HTML>Script
Labels: Pri-2

Comment 5 by neis@chromium.org, Nov 2 2017

Cc: yangguo@chromium.org
I think there are two orthogonal problems.

1) On the V8 side, we throwing the exception we record the precise source location of the offending statement in the isolate's "message" object. Blink should report this location but somehow doesn't. In my local test, Devtools console incorrectly associates the exception with the opening <html> tag in the main document.

2) When a _dynamic_ import fails, then even if the above issue is fixed, we will lose the source location. This is because the isolate's message object is not part of the exception object, and only the latter makes it to the promise handler. The exception object does contain some kind of stack trace but that is not the stack we are interested in (in my test it is always empty, containing only the error string itself).

Comment 6 by neis@chromium.org, Nov 3 2017

To the reporter: As a temporary workaround, you can run chrome with --js-flags=--print-all-exceptions. This should tell you the location of the importing statement where the exception originates:

Exception thrown:
at http://localhost:8888/junk1.js, line 6
0xe2e6319ebb9: [JS_ERROR_TYPE]
[...]
This is a major hurdle to using modules in development. I tried to use the workaround of --js-flags=--print-all-exceptions but it prints way to much to be useful.

Comment 8 by neis@chromium.org, Dec 7 2017

Cc: kozyatinskiy@chromium.org
Regarding (1), could someone have a look at the blink side to see what the problem there is?

Regarding (2), I'm preparing a CL that includes the module specifier in the error message. This will of course also make (1) less serious.
Project Member

Comment 10 by bugdroid1@chromium.org, Dec 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/v8/v8.git/+/d8a5506ce8dd0f866a44e2bb5d685728b993420d

commit d8a5506ce8dd0f866a44e2bb5d685728b993420d
Author: Georg Neis <neis@chromium.org>
Date: Fri Dec 08 09:11:58 2017

[modules] Include module specifier in instantiation error messages.

Bug:  chromium:780819 
Change-Id: I07c5ff3cf955edb087a175ea2d71a35e0f520ec3
Reviewed-on: https://chromium-review.googlesource.com/813839
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49953}
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/src/messages.h
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/src/objects/module.cc
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/src/objects/module.h
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-cycle1.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-cycle2.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-cycle3.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-cycle4.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-cycle5.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-cycle6.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-import1.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-import2.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-import3.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-import4.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-import5.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-import6.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-star-conflict1.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-star-conflict2.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/message/fail/modules-star-default.out
[modify] https://crrev.com/d8a5506ce8dd0f866a44e2bb5d685728b993420d/test/mjsunit/harmony/modules-import-15.js

Comment 11 by neis@chromium.org, Feb 9 2018

Closing this now as the reporter's request has been implemented. I've filed a separate issue for (1):

https://bugs.chromium.org/p/chromium/issues/detail?id=810728

Comment 12 by neis@chromium.org, Feb 9 2018

Status: Fixed (was: Assigned)

Sign in to add a comment