fix: return syntax error when receiving bad json

Fixes #3
This commit is contained in:
Wieland Schöbl
2019-02-06 17:34:46 +01:00
committed by Rainer Killinger
parent f11376ecf8
commit 12b71ba1f1
7 changed files with 73 additions and 32 deletions

View File

@@ -86,8 +86,12 @@ function onError(error: Error | any) {
*/
function onListening() {
const addr = server.address();
const bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
logger.ok('Listening on ' + bind);
if (addr === null) {
logger.warn('Listening on null');
} else {
const bind = typeof addr === 'string'
? 'pipe ' + addr
: 'port ' + addr.port;
logger.ok('Listening on ' + bind);
}
}