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
+4 -1
View File
@@ -170,7 +170,10 @@ export class GitHubRepository {
ghRes.data.encoding as BufferEncoding
).toString("utf-8");
selected.readme = readme;
await model.save();
await RepositoryModel.updateOne(
{ externalId: this.id, "branches.name": opt.branch },
{ $set: { "branches.$.readme": readme } }
).exec();
} catch (error) {
throw new AnonymousError("readme_not_available", {
httpStatus: 404,
+3 -1
View File
@@ -235,7 +235,9 @@ export default class GitHubStream extends GitHubBase {
// (`[fs] write failed`). Swallow the rejection here so an upstream error
// (e.g. GitHub 422 on a too-big blob) doesn't surface as an unhandled
// promise rejection and crash the streamer process.
storage.write(repoId, filePath, stream1, this.type).catch(() => {});
storage
.write(repoId, filePath, stream1, this.type, expected.size)
.catch(() => {});
return stream2;
}