From ddcf71225226bc0929d5c6d609b13ff0489e5b94 Mon Sep 17 00:00:00 2001 From: HampusM Date: Sat, 14 Aug 2021 22:28:17 +0200 Subject: Revamped backend error handling & improved imports in tests --- packages/server/src/git/tree.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/server/src/git/tree.ts') diff --git a/packages/server/src/git/tree.ts b/packages/server/src/git/tree.ts index 7936e5d..4b6d329 100644 --- a/packages/server/src/git/tree.ts +++ b/packages/server/src/git/tree.ts @@ -1,7 +1,7 @@ import { Tree as NodeGitTree } from "nodegit"; import { Repository } from "./repository"; import { BaseTreeEntry, BlobTreeEntry, createTreeEntry, TreeEntry } from "./tree_entry"; -import { createError, TreeError } from "./error"; +import { createError, ErrorWhere, FailedError, NotFoundError } from "./error"; import { pack, Pack } from "tar-stream"; import { Commit } from "./commit"; @@ -42,9 +42,9 @@ export class Tree { public async find(path: string): Promise { const entry = await this._ng_tree.getEntry(path).catch(err => { if(err.errno === -3) { - throw(createError(TreeError, 404, `Path '${path}' not found`)); + throw(createError(ErrorWhere.Tree, NotFoundError, `Path '${path}'`)); } - throw(createError(TreeError, 500, "Failed to get tree path")); + throw(createError(ErrorWhere.Tree, FailedError, "get tree path")); }); return createTreeEntry(this._owner, entry); -- cgit v1.2.3-18-g5258