3/n Easy: Add MC to gate parsing unhandled JS errors in C++

Summary:
Changelog:
[Internal][ErrorHandling] 3/n Add a gate for parsing unhandled JS errors in C++

Gate this just in case it causes issues. Enabling this is definitely a better behavior than before, because we want the JS stack when there is a JS error, not the native stack.

Reviewed By: sammy-SC

Differential Revision: D40397393

fbshipit-source-id: 586b4d7bcf710edb048b5c643646ba2f3c4c302a
This commit is contained in:
Paige Sun
2022-10-18 15:09:23 -07:00
committed by Facebook GitHub Bot
parent b51a350c1e
commit afb124dcf0
2 changed files with 22 additions and 0 deletions
+6
View File
@@ -75,3 +75,9 @@ RCT_EXTERN void RCTSetValidateCanSendEventInRCTEventEmitter(BOOL value);
*/
RCT_EXTERN BOOL RCTGetMemoryPressureUnloadLevel(void);
RCT_EXTERN void RCTSetMemoryPressureUnloadLevel(int value);
/*
* Parse JS stack for unhandled JS errors caught in C++
*/
RCT_EXTERN BOOL RCTGetParseUnhandledJSErrorStackNatively(void);
RCT_EXTERN void RCTSetParseUnhandledJSErrorStackNatively(BOOL value);
+16
View File
@@ -65,3 +65,19 @@ void RCTSetMemoryPressureUnloadLevel(int value)
{
RCTMemoryPressureUnloadLevel = value;
}
/*
* In Bridge mode, parse the JS stack for unhandled JS errors, to display in RedBox.
* When false (previous default behavior), a native stack is displayed in the RedBox.
*/
static BOOL RCTParseUnhandledJSErrorStackNatively = NO;
BOOL RCTGetParseUnhandledJSErrorStackNatively()
{
return RCTParseUnhandledJSErrorStackNatively;
}
void RCTSetParseUnhandledJSErrorStackNatively(BOOL value)
{
RCTParseUnhandledJSErrorStackNatively = value;
}