mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
refactor(repository): keep the error if repo is already init
This commit is contained in:
@@ -83,21 +83,6 @@ const createRepository = async (name: string, config: RepositoryConfig, compress
|
||||
|
||||
const errorMessage = toMessage(error);
|
||||
|
||||
if (errorMessage.includes("already initialized") || errorMessage.includes("config file already exists")) {
|
||||
logger.info(`Repository already exists on backend, connecting to existing repository: ${slug}`);
|
||||
|
||||
await db
|
||||
.update(repositoriesTable)
|
||||
.set({
|
||||
status: "healthy",
|
||||
lastChecked: Date.now(),
|
||||
lastError: null,
|
||||
})
|
||||
.where(eq(repositoriesTable.id, id));
|
||||
|
||||
return { repository: created, status: 201 };
|
||||
}
|
||||
|
||||
await db.delete(repositoriesTable).where(eq(repositoriesTable.id, id));
|
||||
|
||||
throw new InternalServerError(`Failed to initialize repository: ${errorMessage}`);
|
||||
|
||||
Reference in New Issue
Block a user