mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-13 02:42:45 +00:00
feat: improve error message
This commit is contained in:
@@ -2,6 +2,7 @@ import * as mongoose from "mongoose";
|
||||
import Repository from "../Repository";
|
||||
import config from "../../config";
|
||||
import AnonymizedRepositoryModel from "./anonymizedRepositories/anonymizedRepositories.model";
|
||||
import AnonymousError from "../AnonymousError";
|
||||
|
||||
const MONGO_URL = `mongodb://${config.DB_USERNAME}:${config.DB_PASSWORD}@${config.DB_HOSTNAME}:27017/`;
|
||||
|
||||
@@ -23,6 +24,6 @@ export async function connect() {
|
||||
|
||||
export async function getRepository(repoId: string) {
|
||||
const data = await AnonymizedRepositoryModel.findOne({ repoId });
|
||||
if (!data) throw new Error("repo_not_found");
|
||||
if (!data) throw new AnonymousError("repo_not_found", repoId);
|
||||
return new Repository(data);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user