Add error log when failing to convert CDP messageStr (#54962)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Alex Hunt authored and meta-codesync[bot] committed 2025-12-22 07:07:02 -08:00
1 parent 6270051b78
commit bdcda1530e
1 file changed
+3
@@ -47,6 +47,9 @@ NSString *NSStringFromUTF8StringView(std::string_view view)
{
__weak RCTCxxInspectorWebSocketAdapter *weakSelf = self;
NSString *messageStr = NSStringFromUTF8StringView(message);
if (messageStr == nil) {
RCTLogError(@"Failed to convert CDP message string to NSString, message will be dropped!");
}
dispatch_async(dispatch_get_main_queue(), ^{
RCTCxxInspectorWebSocketAdapter *strongSelf = weakSelf;
if (strongSelf != nullptr) {