mirror of
https://github.com/alwxkxk/soft-and-hard.git
synced 2025-02-04 06:42:54 +08:00
fix: 修复 demo0.1 报错时的异常。
This commit is contained in:
parent
2e4f328e13
commit
e0897843fa
@ -141,24 +141,9 @@ function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
console.error('demo0.1服务运行报错,有可能是重复运行导致的端口冲突。')
|
||||
console.error(error)
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user