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

feat(core): show unresolved promise origin #16650

Merged
merged 10 commits into from
Nov 28, 2022

Conversation

bartlomieju
Copy link
Member

@bartlomieju bartlomieju commented Nov 15, 2022

This commit updates unhelpful messages that are raised when event loop stalls
on unresolved top-level promises.

Instead of "Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promises." and "Dynamically imported module evaluation is still pending but there are no pending ops. This situation is often caused by unresolved promises." we are now
printing a message like:

error: Top-level await promise never resolved
[SOURCE LINE]
^
at [FUNCTION NAME] ([FILENAME])

eg:
error: Top-level await promise never resolved
await new Promise((_resolve, _reject) => {});
^
at (file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1)

@bartlomieju bartlomieju changed the title feat: show unresolved promise origin feat(core): show unresolved promise origin Nov 24, 2022
@bartlomieju bartlomieju added this to the 1.29 milestone Nov 24, 2022
@bartlomieju bartlomieju requested a review from dsherret November 28, 2022 00:13
core/runtime.rs Outdated Show resolved Hide resolved
core/error.rs Show resolved Hide resolved
core/error.rs Show resolved Hide resolved
core/error.rs Show resolved Hide resolved
bartlomieju and others added 2 commits November 28, 2022 20:40
Copy link
Member

@dsherret dsherret left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This will be a nice change

@bartlomieju bartlomieju merged commit f526513 into denoland:main Nov 28, 2022
@bartlomieju bartlomieju deleted the try_stalled_promise branch November 28, 2022 22:07
kt3k pushed a commit that referenced this pull request Dec 1, 2022
This commit updates unhelpful messages that are raised when event loop
stalls on unresolved top-level promises.

Instead of "Module evaluation is still pending but there are no pending
ops or dynamic imports. This situation is often caused by unresolved
promises." and "Dynamically imported module evaluation is still pending
but there are no pending ops. This situation is often caused by
unresolved promises." we are now printing a message like: 

error: Top-level await promise never resolved
[SOURCE LINE]
^
    at [FUNCTION NAME] ([FILENAME])

eg:
error: Top-level await promise never resolved
await new Promise((_resolve, _reject) => {});
^
at <anonymous>
(file:///Users/ib/dev/deno/cli/tests/testdata/test/unresolved_promise.ts:1:1)

Co-authored-by: David Sherret <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants