aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/git/error.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-26 23:56:53 +0200
committerHampusM <hampus@hampusmat.com>2021-07-26 23:56:53 +0200
commit09ff261f156a8599d45c1496fe246ded6e035191 (patch)
tree306f79709da372b562eca70d356fa25afcde1f95 /packages/server/src/git/error.ts
parentc575df758b269db8e05c597d5870e948771d4c2b (diff)
Added backend TSDoc/JSDoc comments & refactored a tiny bit
Diffstat (limited to 'packages/server/src/git/error.ts')
-rw-r--r--packages/server/src/git/error.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/packages/server/src/git/error.ts b/packages/server/src/git/error.ts
index a07d349..fff16a4 100644
--- a/packages/server/src/git/error.ts
+++ b/packages/server/src/git/error.ts
@@ -50,6 +50,14 @@ export class MiscError extends BaseError {
type ErrorConstructorType<T> = new (code: number, message: string) => T;
+/**
+ * An error factory
+ *
+ * @param ErrorConstructor - The constructor for what error to create
+ * @param code - A HTTP code
+ * @param message - A error message
+ * @returns An instance of a error
+ */
export function createError<E extends BaseError>(ErrorConstructor: ErrorConstructorType<E>, code: number, message: string): E {
return new ErrorConstructor(code, message);
} \ No newline at end of file