Add error handling

This commit is contained in:
Bluzume 2022-03-14 11:33:07 +13:00 committed by GitHub
parent b906012175
commit 0356930a5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 8 deletions
HorseIsleServer/N00BS

View file

@ -89,10 +89,14 @@ namespace HISP
}
// Start Web Server
cs = new ContentServer();
string[] fileList = Directory.GetFiles(Path.Combine(baseDir, "client"), "*", SearchOption.AllDirectories);
foreach (string file in fileList)
addToList(file);
try{
cs = new ContentServer();
string[] fileList = Directory.GetFiles(Path.Combine(baseDir, "client"), "*", SearchOption.AllDirectories);
foreach (string file in fileList)
addToList(file);
}catch(Exception as e){
MessageBox.Show("Web server failed to start: "+e.Message, "Error starting web server", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
IncrementProgress();
@ -138,13 +142,15 @@ namespace HISP
Item.DoSpecialCases();
IncrementProgress();
try{
GameServer.StartServer();
}catch(Exception as e){
MessageBox.Show("Horse Isle server failed to start: "+e.Message, "Error starting web server", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
IncrementProgress();
lfrm.DialogResult = DialogResult.OK;
startForm.Wait();
SystemTrayIcon stry = new SystemTrayIcon();
stry.ShowDialog();