Skip to content

Commit 30051b2

Browse files
luluwu2032facebook-github-bot
authored andcommitted
Remove usage of std::string in EarlyJsErrorHandler
Summary: This would fix test errors caused by including <string> in non-C++ compatible files. Changelog: [General][Changed] - Remove usage of std::string in EarlyJsErrorHandler. Reviewed By: RSNara Differential Revision: D35645334 fbshipit-source-id: 7f04d2c66d53dc1eef63367de1a64ed9273898f5
1 parent fc1f5bb commit 30051b2

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

React/CoreModules/RCTExceptionsManager.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
#import <Foundation/Foundation.h>
99
#import <React/RCTBridgeModule.h>
10-
#import <string>
1110

1211
NS_ASSUME_NONNULL_BEGIN
1312

@@ -39,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
3938
- (void)reportFatalException:(nullable NSString *)message
4039
stack:(nullable NSArray<NSDictionary *> *)stack
4140
exceptionId:(double)exceptionId;
42-
- (void)reportEarlyJsException:(std::string)errorMap;
41+
- (void)reportEarlyJsException:(NSString *)errorMap;
4342

4443
@property (nonatomic, weak) id<RCTExceptionsManagerDelegate> delegate;
4544

React/CoreModules/RCTExceptionsManager.mm

+2-3
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,9 @@ - (void)reportFatal:(NSString *)message
150150
}
151151
}
152152

153-
- (void)reportEarlyJsException:(std::string)errorMap
153+
- (void)reportEarlyJsException:(NSString *)errorStr
154154
{
155-
NSString *errprStr = [NSString stringWithUTF8String:errorMap.c_str()];
156-
NSData *jsonData = [errprStr dataUsingEncoding:NSUTF8StringEncoding];
155+
NSData *jsonData = [errorStr dataUsingEncoding:NSUTF8StringEncoding];
157156
NSError *jsonError;
158157
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData
159158
options:NSJSONWritingPrettyPrinted

0 commit comments

Comments
 (0)