From 132136f8d04aa2fd71c2ee0c93c42917225e6277 Mon Sep 17 00:00:00 2001 From: Sander van Vliet Date: Fri, 8 Dec 2023 15:58:07 +0100 Subject: [PATCH] Handle route loading failures in route builder --- .../ViewModels/MainWindowViewModel.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/RoadCaptain.App.RouteBuilder/ViewModels/MainWindowViewModel.cs b/src/RoadCaptain.App.RouteBuilder/ViewModels/MainWindowViewModel.cs index a0b06dff..08639ee1 100644 --- a/src/RoadCaptain.App.RouteBuilder/ViewModels/MainWindowViewModel.cs +++ b/src/RoadCaptain.App.RouteBuilder/ViewModels/MainWindowViewModel.cs @@ -77,7 +77,15 @@ public MainWindowViewModel( var routeModel = LandingPageViewModel.SelectedRoute?.AsRouteModel(); if (routeModel != null) { - Route.LoadFromRouteModel(routeModel); + try + { + Route.LoadFromRouteModel(routeModel); + statusBarService.Info("Loaded route successfully"); + } + catch (Exception e) + { + statusBarService.Error($"Unable to load route: {e.Message}"); + } } break; }