From 0ac5a5230c4b5dd44db6a8dd7bb7752aff64d71c Mon Sep 17 00:00:00 2001 From: Alex Dvornikov Date: Fri, 17 Nov 2017 03:12:59 -0800 Subject: [PATCH] Make RCTNativeModule::invokeInner explicitely return folly::none in case of error Differential Revision: D6347967 fbshipit-source-id: 88788da321ca75d20b6c1a8e3d41642af7c6155e --- React/Base/RCTAssert.m | 2 +- React/CxxModule/RCTNativeModule.mm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/React/Base/RCTAssert.m b/React/Base/RCTAssert.m index 345dae021..79db51973 100644 --- a/React/Base/RCTAssert.m +++ b/React/Base/RCTAssert.m @@ -131,7 +131,7 @@ void RCTFatal(NSError *error) #endif NSString *name = [NSString stringWithFormat:@"%@: %@", RCTFatalExceptionName, error.localizedDescription]; NSString *message = RCTFormatError(error.localizedDescription, error.userInfo[RCTJSStackTraceKey], 75); - [NSException raise:name format:@"%@", message]; + @throw [[NSException alloc] initWithName:name reason:message userInfo:nil]; #if DEBUG } @catch (NSException *e) {} #endif diff --git a/React/CxxModule/RCTNativeModule.mm b/React/CxxModule/RCTNativeModule.mm index 4fbe0a141..25e62cb33 100644 --- a/React/CxxModule/RCTNativeModule.mm +++ b/React/CxxModule/RCTNativeModule.mm @@ -112,6 +112,8 @@ static MethodCallResult invokeInner(RCTBridge *bridge, RCTModuleData *moduleData exception, method.JSMethodName, moduleData.name, objcParams, exception.callStackSymbols]; RCTFatal(RCTErrorWithMessage(message)); } + + return folly::none; } }