Skip to content

Commit bdcda15

Browse files
huntiemeta-codesync[bot]
authored andcommitted
Add error log when failing to convert CDP messageStr (#54962)
Summary: Pull Request resolved: #54962 Following, D89659683 add a debug error log whenever a failing `NSStringFromUTF8StringView()` conversion means we ignore delivering a CDP message on iOS. There is probably scope to fail more loudly here (crash the app, or send a debug CDP event to the frontend), but am inserting this for now. Changelog: [Internal] Reviewed By: vzaidman Differential Revision: D89659685 fbshipit-source-id: 3fe772ed879a33aa86b5eb1a0edf38c2804d7448
1 parent 6270051 commit bdcda15

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

packages/react-native/React/Inspector/RCTCxxInspectorWebSocketAdapter.mm

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ - (void)send:(std::string_view)message
4747
{
4848
__weak RCTCxxInspectorWebSocketAdapter *weakSelf = self;
4949
NSString *messageStr = NSStringFromUTF8StringView(message);
50+
if (messageStr == nil) {
51+
RCTLogError(@"Failed to convert CDP message string to NSString, message will be dropped!");
52+
}
5053
dispatch_async(dispatch_get_main_queue(), ^{
5154
RCTCxxInspectorWebSocketAdapter *strongSelf = weakSelf;
5255
if (strongSelf != nullptr) {

0 commit comments

Comments
 (0)