mirror of
https://github.com/Nathanwoodburn/FireWallet.git
synced 2024-11-24 08:08:14 +11:00
main: Added error checking in new cold wallet creation
This commit is contained in:
parent
7388710704
commit
10662f5910
@ -196,11 +196,11 @@ namespace FireWallet
|
|||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
else if (page == 4)
|
else if (page == 4)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// Import Ledger
|
// Import Ledger
|
||||||
buttonNext.Enabled = false;
|
buttonNext.Enabled = false;
|
||||||
|
|
||||||
|
|
||||||
var proc = new Process();
|
var proc = new Process();
|
||||||
proc.StartInfo.CreateNoWindow = true;
|
proc.StartInfo.CreateNoWindow = true;
|
||||||
proc.StartInfo.RedirectStandardInput = true;
|
proc.StartInfo.RedirectStandardInput = true;
|
||||||
@ -225,7 +225,16 @@ namespace FireWallet
|
|||||||
proc.WaitForExit();
|
proc.WaitForExit();
|
||||||
|
|
||||||
mainForm.AddLog(outputBuilder.ToString());
|
mainForm.AddLog(outputBuilder.ToString());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
mainForm.AddLog(ex.Message);
|
||||||
|
NotifyForm notify = new NotifyForm("Error importing wallet\n" + ex.Message);
|
||||||
|
notify.ShowDialog();
|
||||||
|
notify.Dispose();
|
||||||
|
this.Close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -248,21 +257,27 @@ namespace FireWallet
|
|||||||
req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key)));
|
req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.ASCIIEncoding.ASCII.GetBytes("x:" + key)));
|
||||||
req.Content = new StringContent(content);
|
req.Content = new StringContent(content);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
// Send request
|
// Send request
|
||||||
HttpResponseMessage resp = await httpClient.SendAsync(req);
|
HttpResponseMessage resp = await httpClient.SendAsync(req);
|
||||||
|
|
||||||
try
|
if (resp.IsSuccessStatusCode)
|
||||||
{
|
{
|
||||||
resp.EnsureSuccessStatusCode();
|
return await resp.Content.ReadAsStringAsync();
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
mainForm.AddLog("Put Error: " + await resp.Content.ReadAsStringAsync());
|
||||||
|
return "Error";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
mainForm.AddLog("Put Error: " + ex.Message);
|
mainForm.AddLog("Put Error: " + ex.Message);
|
||||||
mainForm.AddLog(await resp.Content.ReadAsStringAsync());
|
|
||||||
return "Error";
|
return "Error";
|
||||||
}
|
}
|
||||||
|
|
||||||
return await resp.Content.ReadAsStringAsync();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user