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

[expo][expo-dev-launcher] improve error messaging in development clients #18064

Merged
merged 4 commits into from
Jul 6, 2022

Conversation

esamelson
Copy link
Contributor

Why

resolves ENG-5315

Adds some messaging to Expo Go to direct developers to custom development builds (dev clients) if they try to access a native module that doesn't exist.

This PR essentially ports our existing implementation from expo-dev-launcher into the expo package, for use in Expo Go. This does not catch all cases where a missing native module is accessed, but is a fairly straightforward change that will catch at least some cases (most specifically, those modules that try to create a NativeEventEmitter on iOS) while we work on a broader solution.

How

If in Expo Go, replace the global JS error handler with one that does the following:

  • replaces the Native module cannot be null message and its newer counterpart with a more helpful message directing users to dev clients
  • appends a similar message to CodedErrors with the code ERR_UNAVAILABLE (errors stemming from missing expo modules)
  • suppresses the unhelpful Application "main" has not been registered error, if another error was logged beforehand.

Additionally, I updated the dev-launcher's implementation to look for the new counterpart of the Native module cannot be null message, which was changed in RN 0.65.

Test Plan

I am not sure which external modules can be used to test this -- I tried react-native-ble-manager, but it does not use a NativeEventEmitter, and so it doesn't trigger our code. However, I triggered it manually by calling new NativeEventEmitter(null) to ensure the error is intercepted correctly:

Screen Shot 2022-06-30 at 4 57 33 PM

Simulator Screen Shot - iPhone 13 - 2022-06-30 at 16 57 20

Checklist

  • Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md).
  • This diff will work correctly for expo build (eg: updated @expo/xdl).
  • This diff will work correctly for expo prebuild & EAS Build (eg: updated a module plugin).

@linear
Copy link

linear bot commented Jul 1, 2022

ENG-5315 Catch errors from missing native module in Expo Go

and direct users to dev client

@expo-bot expo-bot added the bot: suggestions ExpoBot has some suggestions label Jul 1, 2022
packages/expo/src/errors/ExpoErrorManager.ts Outdated Show resolved Hide resolved
packages/expo/src/errors/ExpoErrorManager.ts Outdated Show resolved Hide resolved
@expo-bot expo-bot added bot: passed checks ExpoBot has nothing to complain about and removed bot: suggestions ExpoBot has some suggestions labels Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants