Skip to content
This repository has been archived by the owner on Feb 18, 2019. It is now read-only.

Commit

Permalink
Tweak error message for HMR
Browse files Browse the repository at this point in the history
Summary:The error messages are iOS specific right now. This PR improves them to include the Android bits also.

![screenshot_20160322-000431](https://cloud.githubusercontent.com/assets/1174278/13929839/2bccce5e-efc2-11e5-9db3-f72dcf486412.png)
Closes facebook#6546

Differential Revision: D3077815

Pulled By: martinbigio

fb-gh-sync-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
shipit-source-id: 344430d350023e78bd5fdae923eb4b6ce2924be5
  • Loading branch information
satya164 authored and Facebook Github Bot 3 committed Mar 21, 2016
1 parent 2a2ba4b commit 97a97b3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
28 changes: 23 additions & 5 deletions Libraries/Utilities/HMRClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,18 +40,36 @@ const HMRClient = {

const activeWS = new WebSocket(wsUrl);
activeWS.onerror = (e) => {
throw new Error(
let error = (
`Hot loading isn't working because it cannot connect to the development server.
Ensure the following:
- Node server is running and available on the same network
- run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
Try the following to fix the issue:
- Ensure that the packager server is running and available on the same network`
);

if (Platform.OS === 'ios') {
error += (
`
- Ensure that the Packager server URL is correctly set in AppDelegate`
);
} else {
error += (
`
- Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices
- If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device
- If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081`
);
}

error += (
`
URL: ${host}:${port}
Error: ${e.message}`
);

throw new Error(error);
};
activeWS.onmessage = ({data}) => {
// Moving to top gives errors due to NativeModules not being initialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ public void onFailure(Request request, IOException e) {

StringBuilder sb = new StringBuilder();
sb.append("Could not connect to development server.\n\n")
.append("URL: ").append(request.urlString()).append("\n\n")
.append("Try the following to fix the issue:\n")
.append("\u2022 Ensure that the packager server is running\n")
.append("\u2022 Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices\n")
.append("\u2022 If you're on a physical device connected to the same machine, run 'adb reverse tcp:8081 tcp:8081' to forward requests from your device\n")
.append("\u2022 If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081");
.append("\u2022 If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:8081\n\n")
.append("URL: ").append(request.urlString());
callback.onFailure(new DebugServerException(sb.toString()));
}

Expand Down

0 comments on commit 97a97b3

Please sign in to comment.