forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit '03a51da727022d96f7f9bbc0840b1409121d0429' into features…
…/expose_host_delegate
- Loading branch information
Showing
57 changed files
with
592 additions
and
505 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/debugger-frontend/dist/third-party/front_end/core/i18n/locales/en-US.json
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/debugger-frontend/dist/third-party/front_end/entrypoints/rn_fusebox/rn_fusebox.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ges/debugger-frontend/dist/third-party/front_end/entrypoints/rn_inspector/rn_inspector.js
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
.../debugger-frontend/dist/third-party/front_end/panels/rn_welcome/rn_welcome-legacy-meta.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/debugger-frontend/dist/third-party/front_end/panels/rn_welcome/rn_welcome-meta.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
packages/debugger-frontend/dist/third-party/front_end/panels/rn_welcome/rn_welcome.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @format | ||
* @flow strict | ||
*/ | ||
|
||
'use strict'; | ||
|
||
import type {ExtendedError} from './ExtendedError'; | ||
|
||
import {SyntheticError, handleException} from './ExceptionsManager'; | ||
|
||
type ErrorInfo = { | ||
+componentStack?: ?string, | ||
// $FlowFixMe[unclear-type] unknown props and state. | ||
+errorBoundary?: ?React$Component<any, any>, | ||
}; | ||
|
||
export function onUncaughtError(errorValue: mixed, errorInfo: ErrorInfo): void { | ||
let error; | ||
|
||
// Typically, `errorValue` should be an error. However, other values such as | ||
// strings (or even null) are sometimes thrown. | ||
if (errorValue instanceof Error) { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (errorValue: ExtendedError); | ||
} else if (typeof errorValue === 'string') { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (new SyntheticError(errorValue): ExtendedError); | ||
} else { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (new SyntheticError('Unspecified error'): ExtendedError); | ||
} | ||
try { | ||
// $FlowFixMe[incompatible-use] this is in try/catch. | ||
error.componentStack = errorInfo.componentStack; | ||
error.isComponentError = true; | ||
} catch { | ||
// Ignored. | ||
} | ||
|
||
// Uncaught errors are fatal. | ||
handleException(error, true); | ||
} | ||
|
||
export function onCaughtError(errorValue: mixed, errorInfo: ErrorInfo): void { | ||
let error; | ||
|
||
// Typically, `errorValue` should be an error. However, other values such as | ||
// strings (or even null) are sometimes thrown. | ||
if (errorValue instanceof Error) { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (errorValue: ExtendedError); | ||
} else if (typeof errorValue === 'string') { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (new SyntheticError(errorValue): ExtendedError); | ||
} else { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (new SyntheticError('Unspecified error'): ExtendedError); | ||
} | ||
try { | ||
// $FlowFixMe[incompatible-use] this is in try/catch. | ||
error.componentStack = errorInfo.componentStack; | ||
error.isComponentError = true; | ||
} catch { | ||
// Ignored. | ||
} | ||
|
||
// Caught errors are not fatal. | ||
handleException(error, false); | ||
} | ||
|
||
export function onRecoverableError( | ||
errorValue: mixed, | ||
errorInfo: ErrorInfo, | ||
): void { | ||
let error; | ||
|
||
// Typically, `errorValue` should be an error. However, other values such as | ||
// strings (or even null) are sometimes thrown. | ||
if (errorValue instanceof Error) { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (errorValue: ExtendedError); | ||
} else if (typeof errorValue === 'string') { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (new SyntheticError(errorValue): ExtendedError); | ||
} else { | ||
/* $FlowFixMe[class-object-subtyping] added when improving typing for | ||
* this parameters */ | ||
error = (new SyntheticError('Unspecified error'): ExtendedError); | ||
} | ||
try { | ||
// $FlowFixMe[incompatible-use] this is in try/catch. | ||
error.componentStack = errorInfo.componentStack; | ||
error.isComponentError = true; | ||
} catch { | ||
// Ignored. | ||
} | ||
|
||
// Recoverable errors should only be warnings. | ||
// This will make it a soft error in LogBox. | ||
// TODO: improve the logging for recoverable errors in prod. | ||
console.warn(error); | ||
} |
Oops, something went wrong.