Skip to content

Commit

Permalink
neutralinojs#905: Display error messagebox for server initialization …
Browse files Browse the repository at this point in the history
…failures
  • Loading branch information
shalithasuranga committed May 27, 2022
1 parent 8b13560 commit f095c9d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/neutralino.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"hidden": false,
"resizable": true,
"exitProcessOnClose": false,
"port": 0
"port": 80
},
"browser": {
"globalVariables": {
Expand Down
2 changes: 1 addition & 1 deletion bin/resources/js/neutralino.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bin/resources/js/neutralino.js.map

Large diffs are not rendered by default.

13 changes: 12 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <thread>
#if defined(_WIN32)
#include <winsock2.h>
#include <websocketpp/error.hpp>
#endif

#include "lib/json/json.hpp"
Expand Down Expand Up @@ -98,7 +99,17 @@ void __startServerAsync() {
json jEnableServer = settings::getOptionForCurrentMode("enableServer");

if(!jEnableServer.is_null() && jEnableServer.get<bool>()) {
navigationUrl = neuserver::init();
try {
navigationUrl = neuserver::init();
}
catch(websocketpp::exception &e) {
int port = settings::getOptionForCurrentMode("port");
pfd::message("Unable to start server",
"Neutralinojs can't initialize the application server on port: " + to_string(port),
pfd::choice::ok,
pfd::icon::error);
std::exit(1);
}
neuserver::startAsync();
}
}
Expand Down

0 comments on commit f095c9d

Please sign in to comment.