diff options
| author | Dan Engelbrecht <[email protected]> | 2024-08-06 13:36:53 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-08-06 13:36:53 +0200 |
| commit | 05d6eeb171f5d11b70e06765d625e1b4eeaa082a (patch) | |
| tree | 132c9d4bb6f6575b6840f7648f627ebc85c392fe /src/zenstore/workspaces.cpp | |
| parent | hardening read of corrupt oplog (#98) (diff) | |
| download | zen-05d6eeb171f5d11b70e06765d625e1b4eeaa082a.tar.xz zen-05d6eeb171f5d11b70e06765d625e1b4eeaa082a.zip | |
changelog (#99)
Skip and report invalid configurations for workspaces instead of crashing
Diffstat (limited to 'src/zenstore/workspaces.cpp')
| -rw-r--r-- | src/zenstore/workspaces.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
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()); + } } } } |