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

Promises swallow syntax errors #22420

Closed
sryze opened this issue Nov 26, 2018 · 0 comments
Closed

Promises swallow syntax errors #22420

sryze opened this issue Nov 26, 2018 · 0 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@sryze
Copy link
Contributor

sryze commented Nov 26, 2018

Environment

  React Native Environment Info:
    System:
      OS: macOS High Sierra 10.13.6
    Binaries:
      Node: 11.0.0 - /usr/local/bin/node
      npm: 6.4.1 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
      Android SDK:
        API Levels: 17, 18, 19, 21, 22, 23, 24, 25, 26, 27, 28
        Build Tools: 23.0.1, 25.0.0, 25.0.1, 26.0.1, 26.0.3, 27.0.3, 28.0.3
        System Images: android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.2 AI-181.5540.7.32.5056338
      Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
    npmPackages:
      react: ^16.6.1 => 16.6.1
      react-native: 0.57.2 => 0.57.2
    npmGlobalPackages:
      create-react-native-app: 2.0.2
      react-native-cli: 2.0.1

Description

.then() blocks and await should not swallow programming errors like syntax errors or undefined variables, they should cause a red box to appear and an error to be logged like with synchronous code. This can make it easier to find and debug errors in asynchronous code.

Reproducible Demo

promise.then(() => {
    console.log(someUndefinedVar) // oops
}).catch(error => {
    // error is passed here
})
@sryze sryze closed this as completed Nov 27, 2018
@facebook facebook locked as resolved and limited conversation to collaborators Nov 27, 2019
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Nov 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

2 participants