From 05d6eeb171f5d11b70e06765d625e1b4eeaa082a Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Tue, 6 Aug 2024 13:36:53 +0200 Subject: changelog (#99) Skip and report invalid configurations for workspaces instead of crashing --- src/zenstore/workspaces.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/zenstore/workspaces.cpp') diff --git a/src/zenstore/workspaces.cpp b/src/zenstore/workspaces.cpp index 01f1cc55f..4cf423d03 100644 --- a/src/zenstore/workspaces.cpp +++ b/src/zenstore/workspaces.cpp @@ -725,13 +725,30 @@ Workspaces::ReadState(const std::filesystem::path& WorkspaceStatePath, { for (const Workspaces::WorkspaceInfo& Workspace : Workspaces) { - if (AddWorkspace(Workspace.Config)) + try { - for (const Workspaces::WorkspaceShareConfiguration& Share : Workspace.Shares) + if (AddWorkspace(Workspace.Config)) { - (void)AddWorkspaceShare(Workspace.Config.Id, Share, PathToIdCB); + for (const Workspaces::WorkspaceShareConfiguration& Share : Workspace.Shares) + { + try + { + (void)AddWorkspaceShare(Workspace.Config.Id, Share, PathToIdCB); + } + catch (const std::exception& Ex) + { + ZEN_WARN("Failed adding workspace share '{}' for workspace '{}'. Reason: '{}'", + Workspace.Config.Id, + Share.Id, + Ex.what()); + } + } } } + catch (const std::exception& Ex) + { + ZEN_WARN("Failed adding workspace '{}'. Reason: '{}'", Workspace.Config.Id, Ex.what()); + } } } } -- cgit v1.2.3