aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/git/tree.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-08-14 22:28:17 +0200
committerHampusM <hampus@hampusmat.com>2021-08-14 22:28:17 +0200
commitddcf71225226bc0929d5c6d609b13ff0489e5b94 (patch)
tree7f788d29af4441e27d709aaec1359e205871a11b /packages/server/src/git/tree.ts
parent81b39ee7848b0fbdcd8b61a04077a58c23580dd1 (diff)
Revamped backend error handling & improved imports in tests
Diffstat (limited to 'packages/server/src/git/tree.ts')
-rw-r--r--packages/server/src/git/tree.ts6
1 files changed, 3 insertions, 3 deletions
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<BaseTreeEntry> {
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);