mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-07 22:42:13 +08:00
Improve red boxes coming from RCTWebSocketExecutor
Reviewed By: tadeuzagallo Differential Revision: D2775452 fb-gh-sync-id: b709e0e725ab76468700466b804237eed9158bfd
This commit is contained in:
committed by
facebook-github-bot-9
parent
ae2f556c71
commit
0cfe76399c
@@ -66,9 +66,9 @@ RCT_EXPORT_MODULE()
|
||||
[NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:startDevToolsURL] delegate:nil];
|
||||
|
||||
if (![self connectToProxy]) {
|
||||
RCTLogError(@"Connection to %@ timed out. Are you running node proxy? If \
|
||||
you are running on the device, check if you have the right IP \
|
||||
address in `RCTWebSocketExecutor.m`.", _url);
|
||||
RCTLogError(@"Connection to %@ timed out. Are you running node proxy? If "
|
||||
"you are running on the device, check if you have the right IP "
|
||||
"address in `RCTWebSocketExecutor.m`.", _url);
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ RCT_EXPORT_MODULE()
|
||||
}
|
||||
if (!runtimeIsReady) {
|
||||
RCTLogError(@"Runtime is not ready. Make sure Chrome is running and not "
|
||||
"paused on a breakpoint or exception and try reloading again.");
|
||||
"paused on a breakpoint or exception and try reloading again.");
|
||||
[self invalidate];
|
||||
return;
|
||||
}
|
||||
@@ -125,7 +125,11 @@ RCT_EXPORT_MODULE()
|
||||
|
||||
- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
|
||||
{
|
||||
RCTLogError(@"WebSocket connection failed with error %@", error);
|
||||
dispatch_semaphore_signal(_socketOpenSemaphore);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
// Give the setUp method an opportunity to report an error first
|
||||
RCTLogError(@"WebSocket connection failed with error %@", error);
|
||||
});
|
||||
}
|
||||
|
||||
- (void)sendMessage:(NSDictionary<NSString *, id> *)message waitForReply:(RCTWSMessageCallback)callback
|
||||
|
||||
@@ -585,7 +585,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
|
||||
|
||||
- (void)logMessage:(NSString *)message level:(NSString *)level
|
||||
{
|
||||
if (RCT_DEBUG) {
|
||||
if (RCT_DEBUG && [_javaScriptExecutor isValid]) {
|
||||
[self enqueueJSCall:@"RCTLog.logIfNoNativeHook"
|
||||
args:@[level, message]];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user