Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better stack trace for module not found error #798

Closed
tbontb-iaq opened this issue Feb 6, 2024 · 2 comments
Closed

Better stack trace for module not found error #798

tbontb-iaq opened this issue Feb 6, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@tbontb-iaq
Copy link

Currently, for common errors, easy-to-locate stack information can be output, for example:

Exception in thread "main" ReferenceError: m is not defined
	at <js> func2(lib/func2.js:4:138)
	at <js> func1(lib/func1.js:3:70-76)
	at <js> default(index.js:3:69-75)
	at <js> :module:eval(main.mjs:3:47-57)
	at org.graalvm.polyglot.Context.eval(Context.java:402)
	at MainKt.main(Main.kt:14)
	at MainKt.main(Main.kt)

However, for module not found errors, the stack information of the exception is not so good at locating the error location:

Exception in thread "main" Error: Error reading: /path/to/lib/not-found.js
	at org.graalvm.polyglot.Context.eval(Context.java:402)
	at MainKt.main(Main.kt:14)
	at MainKt.main(Main.kt)

I wish it would output a more useful error message. In Node, the output is just like the following:

Error [ERR_MODULE_NOT_FOUND]:
Cannot find module '/path/to/lib/not-found.js'
imported from /path/to/lib/func2.js
@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Feb 6, 2024
@oubidar-Abderrahim oubidar-Abderrahim added the enhancement New feature or request label Feb 6, 2024
@oubidar-Abderrahim
Copy link
Member

Tracked internally on GR 51880

@woess
Copy link
Member

woess commented Feb 19, 2024

Implemented in 2b7fefa.

@woess woess closed this as completed Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants