From a2b8762e4deba92007c2c76845ce34d4a1935c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Bigio?= Date: Tue, 22 Sep 2015 15:18:34 -0700 Subject: [PATCH] Add logging information when client's socket gets closed unexpetedly Reviewed By: @amasad Differential Revision: D2468293 --- react-packager/src/SocketInterface/SocketClient.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/react-packager/src/SocketInterface/SocketClient.js b/react-packager/src/SocketInterface/SocketClient.js index 837e7a2c..ca34150e 100644 --- a/react-packager/src/SocketInterface/SocketClient.js +++ b/react-packager/src/SocketInterface/SocketClient.js @@ -46,7 +46,13 @@ class SocketClient { this._sock.on('close', () => { if (!this._closing) { - throw new Error('Server closed unexpectedly' + getServerLogs()); + const sockPathExists = fs.existsSync(sockPath); + throw new Error( + 'Server closed unexpectedly.\n' + + 'Socket path: `' + sockPath + '` ' + + (sockPathExists ? ' exists.' : 'doesn\'t exist') + '\n' + + getServerLogs() + ); } }); }