From f334b68108489269f610d8ba70fc012da9c5f74d Mon Sep 17 00:00:00 2001 From: Xymorot Date: Thu, 3 Oct 2019 00:55:55 +0200 Subject: [PATCH] feat: create error service to centralize the handling of errors --- src/main/services/error.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/main/services/error.ts diff --git a/src/main/services/error.ts b/src/main/services/error.ts new file mode 100644 index 0000000..1970900 --- /dev/null +++ b/src/main/services/error.ts @@ -0,0 +1,9 @@ +// if you would like to add some logging or something similar, start here + +export function throwError(error: any): void { + if (error instanceof Error) { + throw error; + } else { + throw new Error(error); + } +}