Skip to content

Commit

Permalink
Remove usage of std::string in EarlyJsErrorHandler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
luluwu2032 authored and facebook-github-bot committed Apr 25, 2022
1 parent fc1f5bb commit 30051b2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions React/CoreModules/RCTExceptionsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#import <Foundation/Foundation.h>
#import <React/RCTBridgeModule.h>
#import <string>

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -39,7 +38,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)reportFatalException:(nullable NSString *)message
stack:(nullable NSArray<NSDictionary *> *)stack
exceptionId:(double)exceptionId;
- (void)reportEarlyJsException:(std::string)errorMap;
- (void)reportEarlyJsException:(NSString *)errorMap;

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

Expand Down
5 changes: 2 additions & 3 deletions React/CoreModules/RCTExceptionsManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,9 @@ - (void)reportFatal:(NSString *)message
}
}

- (void)reportEarlyJsException:(std::string)errorMap
- (void)reportEarlyJsException:(NSString *)errorStr
{
NSString *errprStr = [NSString stringWithUTF8String:errorMap.c_str()];
NSData *jsonData = [errprStr dataUsingEncoding:NSUTF8StringEncoding];
NSData *jsonData = [errorStr dataUsingEncoding:NSUTF8StringEncoding];
NSError *jsonError;
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:jsonData
options:NSJSONWritingPrettyPrinted
Expand Down

0 comments on commit 30051b2

Please sign in to comment.