fix: fix error message when file is not found

This commit is contained in:
tdurieux
2022-10-19 10:38:44 +02:00
parent 3e2644438e
commit 8508a01c28
4 changed files with 12 additions and 5 deletions

View File

@@ -61,6 +61,13 @@ export default class GitHubStream extends GitHubBase implements SourceBase {
await storage.write(file.originalCachePath, content, file, this);
return stream.Readable.from(content);
} catch (error) {
if (error.status == 404) {
throw new AnonymousError("file_not_found", {
httpStatus: error.status,
cause: error,
object: file,
});
}
throw new AnonymousError("file_too_big", {
httpStatus: error.status,
cause: error,