fix: block creation when workspace summaries fail
This commit is contained in:
@@ -9,6 +9,8 @@ export interface WorkspaceDraft {
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export class WorkspaceSelectionError extends Error {}
|
||||
|
||||
type PolicySelection = {
|
||||
workspaceId: string;
|
||||
generation: number;
|
||||
@@ -65,6 +67,13 @@ export const workspacePolicyGate = {
|
||||
}
|
||||
},
|
||||
|
||||
rejectSummary(workspaceId: string): void {
|
||||
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "summary") return;
|
||||
selection.state = "error";
|
||||
selection.error = new WorkspaceSelectionError("Could not load workspace registry. Please retry.");
|
||||
selection.settle();
|
||||
},
|
||||
|
||||
clear(): void {
|
||||
selection?.supersede();
|
||||
selection = undefined;
|
||||
@@ -79,7 +88,7 @@ export const workspacePolicyGate = {
|
||||
reject(workspaceId: string): void {
|
||||
if (!selection || selection.workspaceId !== workspaceId || selection.state !== "pending") return;
|
||||
selection.state = "error";
|
||||
selection.error = new Error("Selected workspace policy could not be loaded.");
|
||||
selection.error = new WorkspaceSelectionError("Could not load selected workspace policy. Please retry.");
|
||||
selection.settle();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user