diff ServerMonitor/Forms/CheckForm.cs @ 1:9e92780ebc0f

Additional validation for SSH check
author Brad Greco <brad@bgreco.net>
date Tue, 01 Jan 2019 21:14:47 -0500
parents 3e1a2131f897
children 3142e52cbe69
line wrap: on
line diff
--- a/ServerMonitor/Forms/CheckForm.cs	Mon Dec 31 18:32:14 2018 -0500
+++ b/ServerMonitor/Forms/CheckForm.cs	Tue Jan 01 21:14:47 2019 -0500
@@ -137,8 +137,15 @@
                 check.Enabled = EnabledCheckBox.Checked;
                 check.Timeout = (int)TimeoutInput.Value;
                 check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay);
-                checkControl?.UpdateCheck(check);
-                result = check.Validate(saving);
+                try
+                {
+                    checkControl?.UpdateCheck(check);
+                    result = check.Validate(saving);
+                }
+                catch (UpdateCheckException e)
+                {
+                    result = e.Message;
+                }
             }
             if (!result.IsNullOrEmpty())
             {