History

Use tagged workspace read errors

Cursor Agent committed 4 months ago

Commit 7f891481 parent 05760162 files · +75 −8Browse files

Showing the changes to apps/server/src/workspace/WorkspaceFileSystem.test.ts (1 of 2 files). Show all

Unified · Split

apps/server/src/workspace/WorkspaceFileSystem.test.ts+13−4
@@ -137,8 +137,14 @@ it.layer(TestLayer, { excludeTestServices: true })("WorkspaceFileSystemLive", (i · 136 unmodified lines
137 error.message,137 error.message,
138 `Workspace file operation 'workspaceFileSystem.readFile' failed for 'image.bin' in '${cwd}'.`,138 `Workspace file operation 'workspaceFileSystem.readFile' failed for 'image.bin' in '${cwd}'.`,
139 );139 );
140 assert.ok(error.cause instanceof Error);140 assert.strictEqual(
141 assert.strictEqual((error.cause as Error).message, "Binary files cannot be previewed as text.");141 (error.cause as { readonly _tag?: string })._tag,
142 "WorkspaceReadFileBinaryFileError",
143 );
144 assert.strictEqual(
145 (error.cause as { readonly message?: string }).message,
146 "Binary files cannot be previewed as text.",
147 );
142 }),148 }),
143 );149 );
144 150
@@ -163,9 +169,12 @@ it.layer(TestLayer, { excludeTestServices: true })("WorkspaceFileSystemLive", (i · 18 unmodified lines
163 error.message,169 error.message,
164 `Workspace file operation 'workspaceFileSystem.readFile' failed for 'linked-secret.txt' in '${cwd}'.`,170 `Workspace file operation 'workspaceFileSystem.readFile' failed for 'linked-secret.txt' in '${cwd}'.`,
165 );171 );
166 assert.ok(error.cause instanceof Error);
167 assert.strictEqual(172 assert.strictEqual(
168 (error.cause as Error).message,173 (error.cause as { readonly _tag?: string })._tag,
174 "WorkspaceReadFileResolvedOutsideRootError",
175 );
176 assert.strictEqual(
177 (error.cause as { readonly message?: string }).message,
169 "Workspace file path resolves outside the project root.",178 "Workspace file path resolves outside the project root.",
170 );179 );
171 }),180 }),