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

Await: re-throw error when there is no catch block and promise is rejected #5149

Merged

Conversation

irshadshalu
Copy link
Contributor

Fixes #5129 ,

When there is no catch block present in an await, it should throw an error

The change is done as suggested in the issue. I had to pass the hasCatch field since there was no way I could infer whether a catch block was present or not from existing values (I thought of and tried using info.error and similar fields, but they will fail for the case when the catch block has no value or is empty.

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR relates to an outstanding issue, so please reference it in your PR, or create an explanatory one for discussion. In many cases, features are absent for a reason.
  • This message body should clearly illustrate what problems it solves. If there are related issues, remember to reference them.
  • Ideally, include a test that fails without this PR but passes with it. PRs will only be merged once they pass CI. (Remember to npm run lint!)

Tests

  • Run the tests with npm test or yarn test)

@irshadshalu irshadshalu requested a review from tanhauhau August 14, 2020 13:57
@Conduitry Conduitry merged commit e0e4342 into sveltejs:master Aug 17, 2020
taylorzane pushed a commit to taylorzane/svelte that referenced this pull request Dec 17, 2020
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.

await/then blocks don't allow errors (from promise) to bubble up
4 participants