// handle specific listen errors with friendly messages
// handle specific listen errors with friendly messages
switch(error.code){
if("code"inerror){
case'EACCES':
switch(error.code){
console.error(`Port ${port} requires elevated privileges. It's recommended to use port above 1024.`);
case'EACCES':
process.exit(1);
console.error(`Port ${port} requires elevated privileges. It's recommended to use port above 1024.`);
break;
process.exit(1);
case'EADDRINUSE':
case'EADDRINUSE':
console.error(`Port ${port} is already in use. Most likely, another Trilium process is already running. You might try to find it, kill it, and try again.`);
console.error(`Port ${port} is already in use. Most likely, another Trilium process is already running. You might try to find it, kill it, and try again.`);