Skip to content

Promises swallow syntax errors  #22420

Description

@sryze

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
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions