fix(storage): initialize a workspace under the lock and refuse a missing database

This commit is contained in:
yyc12345 committed 2026-10-04 16:11:51 +08:00
1 parent 78e5faa3c4
commit 647232c447
6 files changed
+141 -6

No files matched your search

+20
View File
@@ -55,6 +55,26 @@ public sealed class WorkspaceNotInitializedException : YKanBanException {
}
}
/// <summary>
/// Signals that .ykanban exists but its database file does not, so the
/// workspace data is missing; a new empty database is never created silently.
/// </summary>
public sealed class WorkspaceDatabaseMissingException : YKanBanException {
/// <summary>
/// Gets the database file that was expected to exist.
/// </summary>
public string DatabasePath { get; }
/// <summary>
/// Initializes the exception for a missing workspace database.
/// </summary>
/// <param name="databasePath">The missing database file path.</param>
public WorkspaceDatabaseMissingException(string databasePath)
: base($"The workspace database is missing: {databasePath}") {
DatabasePath = databasePath;
}
}
/// <summary>
/// Signals that another instance already holds the workspace lock, so this
/// process must not touch the workspace.