diff options
author | HampusM <hampus@hampusmat.com> | 2021-08-14 22:28:17 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-08-14 22:28:17 +0200 |
commit | ddcf71225226bc0929d5c6d609b13ff0489e5b94 (patch) | |
tree | 7f788d29af4441e27d709aaec1359e205871a11b /packages/server/src/git/misc.ts | |
parent | 81b39ee7848b0fbdcd8b61a04077a58c23580dd1 (diff) |
Revamped backend error handling & improved imports in tests
Diffstat (limited to 'packages/server/src/git/misc.ts')
-rw-r--r-- | packages/server/src/git/misc.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/packages/server/src/git/misc.ts b/packages/server/src/git/misc.ts index 1fda304..43c7a70 100644 --- a/packages/server/src/git/misc.ts +++ b/packages/server/src/git/misc.ts @@ -1,5 +1,5 @@ import { readFile, readdir } from "fs"; -import { createError, MiscError } from "./error"; +import { createError, ErrorWhere, FailedError } from "./error"; /** * Asynchronously find an item in an array that matches the requirements set by the callback @@ -25,7 +25,7 @@ export function getFile(git_dir: string, repository: string, file: string): Prom return new Promise((resolve, reject) => { readFile(`${git_dir}/${repository}/${file}`, (err, content) => { if(err) { - reject(createError(MiscError, 500, "Failed to open repository file " + file)); + reject(createError(ErrorWhere.Misc, FailedError, `open repository file '${file}'`)); return; } @@ -44,7 +44,7 @@ export function getDirectory(directory: string): Promise<string[]> { return new Promise<string[]>((resolve, reject) => { readdir(directory, (err, dir_content) => { if(err) { - reject(createError(MiscError, 500, "Failed to open directory " + directory)); + reject(createError(ErrorWhere.Misc, FailedError, `open directory '${directory}'`)); return; } |