-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Better error messages for ReactPackage missing empty list implementation #18107
Conversation
Bad Credentials? 😕 > |
019599a
to
be9bb32
Compare
Why tvos ci fails... I edited only android.... |
be9bb32
to
d401179
Compare
d401179
to
697d3fd
Compare
@Nkzn I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
697d3fd
to
48370c1
Compare
thanks bot! I rebased. |
48370c1
to
e1b0da4
Compare
why ci fail...? i rebased again. |
@Nkzn I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
e1b0da4
to
742fb9a
Compare
742fb9a
to
ab6763b
Compare
@Nkzn I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
ab6763b
to
e8fa6a5
Compare
@Nkzn I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
@@ -88,6 +90,12 @@ public void processPackage(ReactPackage reactPackage) { | |||
} else { | |||
nativeModules = reactPackage.createNativeModules(mReactApplicationContext); | |||
} | |||
if (nativeModules == null) { | |||
Log.e(ReactConstants.TAG, | |||
"ReactPackage#createNativeModules returns null. " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use reactPage.getClass().getSimpleName()
to make it easy to identify which package got it wrong.
Thank you for this Pull Request. This is definitely useful. We are currently evaluating how to standardize and make it easier to create native modules and will make sure that error handling works better, see react-native-community/discussions-and-proposals#96. Unfortunately the code here is outdated (I'm sorry we didn't get to it earlier) so I have to close the PR :( |
Motivation
When we create custom ReactPackage for Native Modules or Native UI Components, we often forget to add
Collections.emptyList()
and produceNullPointerException
repeatedly. This error log remind us to add empty code.And also, the NPE message from this probrem is ambiguous. This fix is useful for RN beginners.
Test Plan
This test can do in the RNTester manually.
Test ReactInstanceManager
To show error log in ReactInstanceManager, add ReactPackage into RNTesterApplication like below.
And run RNTester as Android App, the error log will show in LogCat. (with app crashes)
Test NativeModuleRegistryBuilder
Same as test for NativeModuleRegistryBuilder, write like below.
And run RNTester as Android App, the error log will show in LogCat. (without app crashes)
Release Notes
[ANDROID] [ENHANCEMENT] [ReactPackage] - Add error log for ReactPackage missing empty list implementation