chore: improve error messages

This commit is contained in:
tdurieux
2021-09-09 11:53:49 +02:00
parent efec854b46
commit a9d45a150c
16 changed files with 425 additions and 119 deletions

View File

@@ -24,6 +24,10 @@ export async function connect() {
export async function getRepository(repoId: string) {
const data = await AnonymizedRepositoryModel.findOne({ repoId });
if (!data) throw new AnonymousError("repo_not_found", repoId);
if (!data)
throw new AnonymousError("repo_not_found", {
object: repoId,
httpStatus: 400,
});
return new Repository(data);
}