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/misc.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'packages/server/src/git/misc.ts') 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 { return new Promise((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; } -- cgit v1.2.3-18-g5258