From 7fabb02bfe5672380f3ebdfea7b3bd5c32a54149 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 22 Jul 2021 20:23:02 +0200 Subject: Improved error handling in some misc functions --- packages/server/src/git/repository.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'packages/server/src/git/repository.ts') diff --git a/packages/server/src/git/repository.ts b/packages/server/src/git/repository.ts index c95edaa..2b14e89 100644 --- a/packages/server/src/git/repository.ts +++ b/packages/server/src/git/repository.ts @@ -7,7 +7,7 @@ import { Commit } from "./commit"; import { FastifyReply } from "fastify"; import { Tag } from "./tag"; import { Tree } from "./tree"; -import { BranchError, createError, RepositoryError } from "./error"; +import { BaseError, BranchError, createError, RepositoryError } from "./error"; import { isNodeGitReferenceBranch, isNodeGitReferenceTag, Reference } from "./reference"; function getFullRepositoryName(repo_name: string) { @@ -110,9 +110,11 @@ export class Repository { } } + const owner = await getFile(base_dir, getFullRepositoryName(repository), "owner").catch(err => err); + return new Repository(ng_repository, { description: await getFile(base_dir, getFullRepositoryName(repository), "description"), - owner: await getFile(base_dir, getFullRepositoryName(repository), "owner"), + owner: owner instanceof BaseError ? null : owner, branch: branch || "master" }); } -- cgit v1.2.3-18-g5258