Skip to content

Commit

Permalink
Improve red boxes coming from RCTWebSocketExecutor
Browse files Browse the repository at this point in the history
Reviewed By: tadeuzagallo

Differential Revision: D2775452

fb-gh-sync-id: b709e0e725ab76468700466b804237eed9158bfd
  • Loading branch information
javache authored and facebook-github-bot-9 committed Dec 23, 2015
1 parent ae2f556 commit 0cfe763
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
14 changes: 9 additions & 5 deletions Libraries/WebSocket/RCTWebSocketExecutor.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ - (void)setUp
[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;
}
Expand All @@ -81,7 +81,7 @@ - (void)setUp
}
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;
}
Expand Down Expand Up @@ -125,7 +125,11 @@ - (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket

- (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
Expand Down
2 changes: 1 addition & 1 deletion React/Base/RCTBatchedBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ - (void)invalidate

- (void)logMessage:(NSString *)message level:(NSString *)level
{
if (RCT_DEBUG) {
if (RCT_DEBUG && [_javaScriptExecutor isValid]) {
[self enqueueJSCall:@"RCTLog.logIfNoNativeHook"
args:@[level, message]];
}
Expand Down

0 comments on commit 0cfe763

Please sign in to comment.