From dbcdef9bf0e6eedf7c421bcde44da226914def3d Mon Sep 17 00:00:00 2001 From: HeshamTB Date: Sun, 23 Dec 2018 20:39:46 +0300 Subject: [PATCH] Exception handling --- OWTrack/MainForm.cs | 22 +++++++++++++++------- OWTrack/Tracker.cs | 3 +-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/OWTrack/MainForm.cs b/OWTrack/MainForm.cs index 37078c7..67f0db5 100644 --- a/OWTrack/MainForm.cs +++ b/OWTrack/MainForm.cs @@ -144,16 +144,24 @@ namespace OWTrack private void update() { - Wins.Text = tr.GetWins().ToString(); - Losses.Text = tr.GetLosses().ToString(); - if (tr.newSR == 0) + try { - if (tr.srDiff() < 1) { srLabel.Text = tr.startSR.ToString() + " - 0"; } + Wins.Text = tr.GetWins().ToString(); + Losses.Text = tr.GetLosses().ToString(); + if (tr.newSR == 0) + { + if (tr.srDiff() < 1) { srLabel.Text = tr.startSR.ToString() + " - 0"; } + else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); + } else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); + srTextBox.Text = null; + saveManeger.SaveJSON(tr); } - else srLabel.Text = tr.startSR.ToString() + " - " + tr.srDiff(); - srTextBox.Text = null; - saveManeger.SaveJSON(tr); + catch (Exception e) + { + MessageBox.Show(e.Message); + } + } private void AddMatch() diff --git a/OWTrack/Tracker.cs b/OWTrack/Tracker.cs index 2b72175..ff65364 100644 --- a/OWTrack/Tracker.cs +++ b/OWTrack/Tracker.cs @@ -128,8 +128,7 @@ namespace OWTrack } catch (Exception e) { - MessageBox.Show(e.Message); - return false; + throw e; } }