Răsfoiți Sursa

fix failing migration

Dax Raad 4 luni în urmă
părinte
comite
06fe87b361
1 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 2 2
      packages/opencode/src/storage/storage.ts

+ 2 - 2
packages/opencode/src/storage/storage.ts

@@ -23,6 +23,7 @@ export namespace Storage {
   const MIGRATIONS: Migration[] = [
   const MIGRATIONS: Migration[] = [
     async (dir) => {
     async (dir) => {
       const project = path.resolve(dir, "../project")
       const project = path.resolve(dir, "../project")
+      if (!fs.exists(project)) return
       for await (const projectDir of new Bun.Glob("*").scan({
       for await (const projectDir of new Bun.Glob("*").scan({
         cwd: project,
         cwd: project,
         onlyFiles: false,
         onlyFiles: false,
@@ -177,8 +178,7 @@ export namespace Storage {
 
 
   async function withErrorHandling<T>(body: () => Promise<T>) {
   async function withErrorHandling<T>(body: () => Promise<T>) {
     return body().catch((e) => {
     return body().catch((e) => {
-      if (!(e instanceof Error))
-        throw e
+      if (!(e instanceof Error)) throw e
       const errnoException = e as NodeJS.ErrnoException
       const errnoException = e as NodeJS.ErrnoException
       if (errnoException.code === "ENOENT") {
       if (errnoException.code === "ENOENT") {
         throw new NotFoundError({ message: `Resource not found: ${errnoException.path}` })
         throw new NotFoundError({ message: `Resource not found: ${errnoException.path}` })