-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Integrate logbox into earlyjs c++ pipeline #46935
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: D63769385 |
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
695cc4c to
ba065fc
Compare
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
1 similar comment
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
ba065fc to
23c58d6
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
23c58d6 to
2c3ad26
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
2c3ad26 to
cd2dc42
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
cd2dc42 to
d69de89
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
d69de89 to
b630055
Compare
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Differential Revision: D63769385 Reviewed By: javache
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
b630055 to
172f3ef
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
2d1cec7 to
2ec5e9f
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Differential Revision: D63769385 Reviewed By: javache
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
2ec5e9f to
f0916a3
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
f0916a3 to
204b5d7
Compare
Summary: For the js error handling pipeline, the javascript data structure looks like [this](https://www.internalfb.com/code/fbsource/[6181b57f4ba3619f58056bcec65382650d6ff59a]/xplat/js/react-native-github/packages/react-native/src/private/specs/modules/NativeExceptionsManager.js?lines=17-35): ``` export type StackFrame = {| column: ?number, file: ?string, lineNumber: ?number, methodName: string, collapse?: boolean, |}; export type ExceptionData = { message: string, originalMessage: ?string, name: ?string, componentStack: ?string, stack: Array<StackFrame>, id: number, isFatal: boolean, // flowlint-next-line unclear-type:off extraData?: Object, ... }; ``` So, I made the c++ data structure look similar ``` struct ParsedError { struct StackFrame { std::optional<std::string> file; std::string methodName; std::optional<int> lineNumber; std::optional<int> column; }; std::string message; std::optional<std::string> originalMessage; std::optional<std::string> name; std::optional<std::string> componentStack; std::vector<StackFrame> stack; int id; bool isFatal; jsi::Object extraData; }; ``` Notes: * [parseErrorStack](https://fburl.com/code/e27q9gkc) doesn't actually generate a collapse property on the error object. So, I omitted it from the c++. * ExceptionsManager [always provides an extraData field](https://fburl.com/code/2bvcsxac). So, I made it required. * In C++, I just stored extraData as a jsi::Object. I wanted the freedom to store arbitrary key/value pairs. But, I also didn't want to use folly::dynamic. Changelog: [Internal] Differential Revision: D63929580
Summary: This diff re-implements [js error stack trace parsing](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/parseErrorStack.js#L41-L57) in c++. Details: - I migrated [stacktrace-parser](https://github.com/errwischt/stacktrace-parser/blob/ad379de5e5ac056012bbeb12923cf502aefe4710/src/stack-trace-parser.js#L7) - I migrated [parseHermesStack.js](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/parseHermesStack.js#L82) I also migrated all their tests to c++: - [stacktrace-parser tests](https://github.com/errwischt/stacktrace-parser/blob/ad379de5e5ac056012bbeb12923cf502aefe4710/test/stack-trace-parser.spec.js#L5) - [parseHermesStack tests](https://github.com/facebook/react-native/blob/86cac6836502aaeb5c894bff6427e837c52c09e0/packages/react-native/Libraries/Core/Devtools/__tests__/parseHermesStack-test.js#L16) Changelog: [Internal] Differential Revision: D63659013 Reviewed By: javache, NickGerleman
Summary: Before, the c++ pipeline only supported fatal errors. Now, it supports soft errors! Changelog: [Internal] Differential Revision: D63927090
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
204b5d7 to
3314b78
Compare
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
3314b78 to
7b56a76
Compare
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Differential Revision: D63769385 Reviewed By: javache
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Reviewed By: javache Differential Revision: D63769385
|
This pull request was exported from Phabricator. Differential Revision: D63769385 |
7b56a76 to
45aa25b
Compare
Summary: Pull Request resolved: facebook#46935 Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript. ## The API ``` if (global.RN$registerExceptionListener != null) { global.RN$registerExceptionListener( (error: ExtendedExceptionData & {preventDefault: () => mixed}) => { error.preventDefault(); // show logbox }, ); } ``` ## The Future API We want something more aligned with the HTML spec: ``` addEventListener('error', (event) => { event.preventDefault(); // show logbox }); ``` ## Fatals vs soft errors The earlyjs pipeline covers just main bundle execution for now. So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual. Changelog: [Internal] Differential Revision: D63769385 Reviewed By: javache
|
This pull request has been merged in 9619ba5. |
Summary:
Now, whenever the earlyjs c++ pipeline handles an error, it'll invoke callbacks registered via javascript.
The API
The Future API
We want something more aligned with the HTML spec:
Fatals vs soft errors
The earlyjs pipeline covers just main bundle execution for now.
So, it displays logbox only if there was a soft error. If there was a fatal error, it'll just continue to display redbox as usual.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D63769385