Improve error handling

This commit is contained in:
tdurieux
2026-05-06 18:43:36 +03:00
parent aae6eae6eb
commit da78708b7b
16 changed files with 360 additions and 49 deletions
+8 -2
View File
@@ -662,7 +662,10 @@ router.post(
addedAt: new Date(),
});
repo.model.coauthors = list;
await repo.model.save();
await AnonymizedRepositoryModel.updateOne(
{ _id: repo.model._id },
{ $set: { coauthors: list } }
).exec();
res.json(repo.model.coauthors);
} catch (error) {
handleError(error, res, req);
@@ -690,7 +693,10 @@ router.delete(
repo.model.coauthors = (repo.model.coauthors || []).filter(
(c) => c.username.toLowerCase() !== target.toLowerCase()
);
await repo.model.save();
await AnonymizedRepositoryModel.updateOne(
{ _id: repo.model._id },
{ $set: { coauthors: repo.model.coauthors } }
).exec();
res.json(repo.model.coauthors);
} catch (error) {
handleError(error, res, req);