Skip to content

Improve exception thrown when classes can't compile to be more clear#33897

Closed
Daniel9z wants to merge 1 commit into
facebook:mainfrom
Daniel9z:export-D36606279
Closed

Improve exception thrown when classes can't compile to be more clear#33897
Daniel9z wants to merge 1 commit into
facebook:mainfrom
Daniel9z:export-D36606279

Conversation

@Daniel9z
Copy link
Copy Markdown
Contributor

Summary:
Now the exception will display the class which caused the exception as well as helpful information as to why.

We've seen this happen a bunch due and have been very confused by the error message. It turns out that this processor runs before the classes listed are compiled. This means that if there's a compile error (or a missing import) the user will only see that this processor crashed, and not the compile error.

The additional information in the error is:

java.lang.RuntimeException: Could not load classes set in ReactModuleList.nativeModules. Check that they exist and are imported correctly on class: com.meta.x.y.ReactPackage

In this case, com.meta.x.y.ReactPackage is the class which needs to be fixed. Before, the error message made no mention of this class or the annotation.

Changelog: [Internal] This will change the way the annotation processor crashes. It will throw a RuntimeException instead of a ClassCastException.

Differential Revision: D36606279

@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported p: Facebook Partner: Facebook Partner labels May 23, 2022
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D36606279

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented May 23, 2022

Platform Engine Arch Size (bytes) Diff
ios - universal n/a --

Base commit: 0ef73f2
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D36606279

@analysis-bot
Copy link
Copy Markdown

analysis-bot commented May 24, 2022

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 7,786,028 +0
android hermes armeabi-v7a 7,189,683 +0
android hermes x86 8,097,398 +0
android hermes x86_64 8,075,011 +0
android jsc arm64-v8a 9,654,599 +0
android jsc armeabi-v7a 8,427,102 +0
android jsc x86 9,606,779 +0
android jsc x86_64 10,201,322 +0

Base commit: fd9c677
Branch: main

@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D36606279

…33897)

Summary:
Pull Request resolved: #33897

Now the exception will display the class which caused the exception as well as helpful information as to why.

We've seen this happen a bunch due and have been very confused by the error message. It turns out that this processor runs before the classes listed are compiled. This means that if there's a compile error (or a missing import) the user will only see that this processor crashed, and not the compile error.

The additional information in the error is:

`java.lang.RuntimeException: Could not load classes set in ReactModuleList.nativeModules. Check that they exist and are imported correctly on class: com.meta.x.y.ReactPackage`

In this case,  `com.meta.x.y.ReactPackage` is the class which needs to be fixed. Before, the error message made no mention of this class or the annotation.

Changelog: [Internal] This will change the way the annotation processor crashes. It will throw a RuntimeException instead of a ClassCastException.

Reviewed By: javache

Differential Revision: D36606279

fbshipit-source-id: 957f20b5aa396c7d3953b6780c62e4e5857cf5e2
@facebook-github-bot
Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D36606279

@react-native-bot
Copy link
Copy Markdown
Collaborator

This pull request was successfully merged by @Daniel9z in a3e25b2.

When will my fix make it into a release? | Upcoming Releases

@react-native-bot react-native-bot added the Merged This PR has been merged. label May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants