improve error logging

This commit is contained in:
Kevin Darby committed 2019-04-04 13:05:40 -04:00
1 parent 19c0b94803
commit 01128639ce
2 files changed
+23 -15

No files matched your search

+22 -14
View File
@@ -79,28 +79,36 @@ namespace mbts.ui.shell
static internal string stunnel_job_error { get; private set;}
void init_stunnel(string[] argv)
{
var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BTS\\stunnel\\";
if(File.Exists(path + "config\\stunnel.conf"))
try
{
try
var path = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\BTS\\stunnel\\";
if (File.Exists(path + "config\\stunnel.conf"))
{
uint job_error = BTSUINativeMethods.setup_process_job_object();
if(job_error != 0)
stunnel_job_error = "Stunnel Job Error code: " + job_error;
_stunnel_process = Process.Start(path + "bin\\stunnel.exe");
string config_error; bool success = false;
if(_stunnel_process != null)
uint job_error = BTSUINativeMethods.setup_process_job_object();
if(job_error == 0)
{
for(int i = 0; i < 10; i++)
_stunnel_process = Process.Start(path + "bin\\stunnel.exe");
string config_error; bool success = false;
if(_stunnel_process != null)
{
if(success = mbts.config.Configuration.try_initialize(out config_error))
break;
System.Threading.Thread.Sleep(500);
for(int i = 0; i < 10; i++)
{
if(success = mbts.config.Configuration.try_initialize(out config_error))
break;
System.Threading.Thread.Sleep(500);
}
}
else
stunnel_job_error = "Stunnel Job Error code: " + job_error + " could not start stunnel";
}
else
stunnel_job_error = "Stunnel Job Error code: " + job_error;
}
catch {} //can't log here
}
catch(Exception ex)
{
stunnel_job_error = "Error starting stunnel: " + ex.Message;
}
}
public new int Run() {
@@ -94,7 +94,7 @@ namespace mbts.ui.shell {
Configuration.initialize();
}
catch (ApplicationException e) {
ErrorMessage = (e.Message ?? string.Empty) + (App.stunnel_job_error ?? string.Empty);
ErrorMessage = (e.Message ?? string.Empty) + " " + (App.stunnel_job_error ?? string.Empty);
HasFatalError = true;
return;
}