-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Improve the error thrown when a bundle fails to load #51070
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
Conversation
This pull request was exported from Phabricator. Differential Revision: D73925027 |
Summary: Changelog: [General][Internal][Breaking] When a bundle is failing to load throw an error of special type. Reviewed By: hoxyq Differential Revision: D73925027
This pull request was exported from Phabricator. Differential Revision: D73925027 |
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.
LGTM!
Summary: Changelog: [General][Internal][Breaking] When a bundle is failing to load throw an error of special type. ### Breaking `didCompleteNetworkResponse` now throws an Error instead of throwing a string. In dev, we use [lazy bundling](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro) which allows us to re-build only the parts of the app that are changed. However the function that loads these lazy bundles in `loadBundleFromServer.js` for requests that reach `didCompleteNetworkResponse` with an error **throws a string representing the error message** which makes debugging very inconvenient because it lacks stack trace and error type. Throwing strings is not a standard practice. We better throw an error in these cases so it can be handled better. Why a special type of error? * As you can see in the "after", in the test plan below, even with a stack trace, it might be hard to know where this error originates from * Also so extra information can be added on it. Currently adding "url" * Also to support error handling based on the type of error Differential Revision: D73925027
This pull request was exported from Phabricator. Differential Revision: D73925027 |
Summary: Changelog: [General][Internal][Breaking] When a bundle is failing to load throw an error of special type. ### Breaking `didCompleteNetworkResponse` now throws an Error instead of throwing a string. In dev, we use [lazy bundling](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0605-lazy-bundling.md#__loadbundleasync-in-metro) which allows us to re-build only the parts of the app that are changed. However the function that loads these lazy bundles in `loadBundleFromServer.js` for requests that reach `didCompleteNetworkResponse` with an error **throws a string representing the error message** which makes debugging very inconvenient because it lacks stack trace and error type. Throwing strings is not a standard practice. We better throw an error in these cases so it can be handled better. Why a special type of error? * As you can see in the "after", in the test plan below, even with a stack trace, it might be hard to know where this error originates from * Also so extra information can be added on it. Currently adding "url" * Also to support error handling based on the type of error Differential Revision: D73925027
This pull request was exported from Phabricator. Differential Revision: D73925027 |
This pull request has been merged in 0750b5f. |
This pull request was successfully merged by @vzaidman in 0750b5f When will my fix make it into a release? | How to file a pick request? |
Summary: Changelog: [General][Internal][Breaking] When a bundle is failing to load throw an error of special type.
Breaking
didCompleteNetworkResponse
now throws an Error instead of throwing a string.In dev, we use lazy bundling which allows us to re-build only the parts of the app that are changed.
However the function that loads these lazy bundles in
loadBundleFromServer.js
for requests that reachdidCompleteNetworkResponse
with an error throws a string representing the error message which makes debugging very inconvenient because it lacks stack trace and error type. Throwing strings is not a standard practice. We better throw an error in these cases so it can be handled better.Why a special type of error?
Differential Revision: D73925027