Skip to content

Commit 8b001e3

Browse files
committed
Fix issue error notification when first fetching registry
1 parent 07ae135 commit 8b001e3

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/extension/ui/src/Registry.ts

+9-10
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,19 @@ export const getRegistry = async (client: v1.DockerDesktopClient) => {
1010
}
1111
return {};
1212
}
13+
const writeRegistryIfNotExists = async () => {
14+
const registry = await readFileInPromptsVolume(client, 'registry.yaml')
15+
16+
if (!registry) {
17+
console.log('writeRegistryIfNotExists: no registry')
18+
await writeFileToPromptsVolume(client, JSON.stringify({ files: [{ path: 'registry.yaml', content: 'registry: {}' }] }))
19+
}
20+
}
1321
try {
22+
await writeRegistryIfNotExists()
1423
return await parseRegistry()
1524
}
1625
catch (error) {
17-
if (typeof error === 'object' && error && 'stderr' in error && error.stderr && (error.stderr as string).includes('No such file or directory')) {
18-
const payload = JSON.stringify({
19-
files: [{
20-
path: 'registry.yaml',
21-
content: 'registry: {}'
22-
}]
23-
})
24-
await writeFileToPromptsVolume(client, payload)
25-
return await parseRegistry();
26-
}
2726
client.desktopUI.toast.error('Failed to get prompt registry: ' + error)
2827
return {};
2928
}

0 commit comments

Comments
 (0)