fix error handling in packager

Summary: Currently on error I have following output:
```
 ERROR  Packager can't listen on port 8081
Most likely another process is already using this port
Run the following command to find out which process:

   lsof -n -i4TCP:8081

You can either shut down the other process:

   kill -9 <PID>

or run packager on different port.

See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
/Users/nucleartux/Work/projects/react-native/local-cli/server/server.js:90
    if (error.code === 'EADDRINUSE') {
             ^

TypeError: Cannot read property 'code' of undefined
    at process.<anonymous> (/Users/nucleartux/Work/projects/react-native/local-cli/server/server.js:104:14)
    at emitOne (events.js:77:13)
    at process.emit (events.js:169:7)
    at process._fatalException (node.js:211:26)
```
Closes https://github.com/facebook/react-native/pull/3765

Reviewed By: svcscm

Differential Revision: D2595537

Pulled By: martinbigio

fb-gh-sync-id: e11ec2e6e8794bf5fe7570e27cd327777d8b300c
This commit is contained in:
Adrov Igor 2015-10-29 08:51:17 -07:00 committed by facebook-github-bot-3
parent 88655001e3
commit 95972cfd08

View File

@ -122,7 +122,7 @@ function _server(argv, config, resolve, reject) {
}
console.log('\nSee', chalk.underline('http://facebook.github.io/react-native/docs/troubleshooting.html'));
console.log('for common problems and solutions.');
reject();
process.exit(1);
});
// TODO: remove once we deprecate this arg