letmessage=error.stack||"An unexpected error has occurred.";
// handle specific listen errors with friendly messages
if("code"inerror){
@ -141,13 +137,12 @@ function startHttpServer() {
case'EADDRINUSE':
message=`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.`;
break;
case'EADDRNOTAVAIL':
message=`Unable to start the server on host '${host}'. Make sure the host (defined in 'config.ini' or via the 'TRILIUM_HOST' environment variable) is an IP address that can be listened on.`;
break;
}
}
if(!message){
message="An unexpected error has occurred.";
}
if(utils.isElectron()){
import("electron").then(({dialog})=>{
dialog.showErrorBox("Error while initializing the server",message);