diff --git a/src/common/lib/utils.ts b/src/common/lib/utils.ts index 1d078ba..7524d7e 100644 --- a/src/common/lib/utils.ts +++ b/src/common/lib/utils.ts @@ -1,11 +1,5 @@ import * as B64js from "base64-js"; -class UtilsError extends Error { - constructor(...args: ConstructorParameters) { - super(...args); - this.name = "UtilsError"; - } -} export type Base64UrlString = string; @@ -69,7 +63,7 @@ export function b64UrlEncode(b64UrlString: string): string { .replace(/\//g, "_") .replace(/\=/g, ""); } catch (error) { - throw new UtilsError("Failed to encode string", { cause: error }); + throw new Error("Failed to encode string", { cause: error }); } } @@ -82,6 +76,6 @@ export function b64UrlDecode(b64UrlString: string): string { : (padding = 4 - (b64UrlString.length % 4)); return b64UrlString.concat("=".repeat(padding)); } catch (error) { - throw new UtilsError("Failed to decode string", { cause: error }); + throw new Error("Failed to decode string", { cause: error }); } } diff --git a/test/common/lib/utils.ts b/test/common/lib/utils.ts index 218456e..63cfbba 100644 --- a/test/common/lib/utils.ts +++ b/test/common/lib/utils.ts @@ -13,7 +13,6 @@ describe("Common Utils", function () { } catch (error) { expect(error).to.have.property("message"); expect(error).to.have.property("cause"); - expect((error as Error).name).to.be.string("UtilsError"); expect((error as Error).message).to.be.string(testCase.message); } }); @@ -29,7 +28,6 @@ describe("Common Utils", function () { } catch (error) { expect(error).to.have.property("message"); expect(error).to.have.property("cause"); - expect((error as Error).name).to.be.string("UtilsError"); expect((error as Error).message).to.be.string(testCase.message); } });