aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/git/error.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/error.ts
parent81b39ee7848b0fbdcd8b61a04077a58c23580dd1 (diff)
Revamped backend error handling & improved imports in tests
Diffstat (limited to 'packages/server/src/git/error.ts')
-rw-r--r--packages/server/src/git/error.ts75
1 files changed, 0 insertions, 75 deletions
diff --git a/packages/server/src/git/error.ts b/packages/server/src/git/error.ts
deleted file mode 100644
index b89b994..0000000
--- a/packages/server/src/git/error.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-export abstract class BaseError implements Error {
- code: number;
- name: string;
- message: string;
- stack?: string | undefined;
-
- constructor(code: number, message: string) {
- this.name = "Githermit Error";
-
- this.code = code;
- this.message = message;
- }
-}
-
-export class RepositoryError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A repository error has occured: " + message);
- }
-}
-
-export class BranchError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A branch error has occured: " + message);
- }
-}
-
-export class TagError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A tag error has occured: " + message);
- }
-}
-
-export class TreeError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A tree error has occured: " + message);
- }
-}
-
-export class BlobError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A blob error has occured: " + message);
- }
-}
-
-export class MiscError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A misc error has occured: " + message);
- }
-}
-
-export class DiffError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A diff error has occured: " + message);
- }
-}
-
-export class CommitError extends BaseError {
- constructor(code: number, message: string) {
- super(code, "A commit error has occured: " + message);
- }
-}
-
-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