mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-09-12 21:58:57 +02:00
Improve error handling
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user