From c45dbc5da1f569d91ead35bbc51be825846eedd1 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Mon, 27 Nov 2023 17:26:37 +0100 Subject: [PATCH] Catch exception if one occurrs during saving --- src/BreCalClient/MainWindow.xaml.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index 3402794..9389a70 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -189,8 +189,15 @@ namespace BreCalClient esc.ShipcallModel.Shipcall?.Participants.Clear(); foreach (ParticipantAssignment pa in esc.ShipcallModel.AssignedParticipants.Values) esc.ShipcallModel.Shipcall?.Participants.Add(pa); - this._api.ShipcallsPost(esc.ShipcallModel.Shipcall); // save new ship call - this.AddShipcall(esc.ShipcallModel); + try + { + this._api.ShipcallsPost(esc.ShipcallModel.Shipcall); // save new ship call + this.AddShipcall(esc.ShipcallModel); + } + catch(Exception ex) + { + this.ShowErrorDialog(ex.ToString(), ex.Message); + } _refreshImmediately = true; // set flag to avoid timer loop termination _tokenSource.Cancel(); // force timer loop end