From ebdf78765f9cde7b001adba7e457987963643307 Mon Sep 17 00:00:00 2001 From: 0xkenj1 Date: Thu, 25 Jul 2024 00:23:32 -0300 Subject: [PATCH] fix: exception naming --- .../src/exceptions/rpcUrlsEmpty.exception.ts | 4 ++-- packages/automated-dispute/src/protocolProvider.ts | 4 ++-- packages/automated-dispute/tests/protocolProvider.spec.ts | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/automated-dispute/src/exceptions/rpcUrlsEmpty.exception.ts b/packages/automated-dispute/src/exceptions/rpcUrlsEmpty.exception.ts index 4981e44..8bdf433 100644 --- a/packages/automated-dispute/src/exceptions/rpcUrlsEmpty.exception.ts +++ b/packages/automated-dispute/src/exceptions/rpcUrlsEmpty.exception.ts @@ -1,6 +1,6 @@ -export class RpcUrlsEmptyException extends Error { +export class RpcUrlsEmpty extends Error { constructor() { super("The rpcUrls array cannot be empty."); - this.name = "RpcUrlsEmptyException"; + this.name = "RpcUrlsEmpty"; } } diff --git a/packages/automated-dispute/src/protocolProvider.ts b/packages/automated-dispute/src/protocolProvider.ts index c1a0b2d..db91364 100644 --- a/packages/automated-dispute/src/protocolProvider.ts +++ b/packages/automated-dispute/src/protocolProvider.ts @@ -11,7 +11,7 @@ import { import { arbitrum } from "viem/chains"; import { epochManagerAbi, oracleAbi } from "./abis/index.js"; -import { RpcUrlsEmptyException } from "./exceptions/rpcUrlsEmpty.exception.js"; +import { RpcUrlsEmpty } from "./exceptions/rpcUrlsEmpty.exception.js"; import { ProtocolContractsAddresses } from "./types/protocolProvider.js"; export class ProtocolProvider { @@ -34,7 +34,7 @@ export class ProtocolProvider { */ constructor(rpcUrls: string[], contracts: ProtocolContractsAddresses) { if (rpcUrls.length === 0) { - throw new RpcUrlsEmptyException(); + throw new RpcUrlsEmpty(); } this.client = createPublicClient({ chain: arbitrum, diff --git a/packages/automated-dispute/tests/protocolProvider.spec.ts b/packages/automated-dispute/tests/protocolProvider.spec.ts index 2193f19..692a526 100644 --- a/packages/automated-dispute/tests/protocolProvider.spec.ts +++ b/packages/automated-dispute/tests/protocolProvider.spec.ts @@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, Mock, vi } from "vitest"; import { epochManagerAbi } from "../src/abis/epochManager.js"; import { oracleAbi } from "../src/abis/oracle.js"; -import { RpcUrlsEmptyException } from "../src/exceptions/rpcUrlsEmpty.exception.js"; +import { RpcUrlsEmpty } from "../src/exceptions/rpcUrlsEmpty.exception.js"; import { ProtocolProvider } from "../src/index.js"; import { ProtocolContractsAddresses } from "../src/types/index.js"; @@ -68,9 +68,7 @@ describe("ProtocolProvider", () => { }); }); it("throws if rpcUrls are empty", () => { - expect(() => new ProtocolProvider([], mockContractAddress)).toThrowError( - RpcUrlsEmptyException, - ); + expect(() => new ProtocolProvider([], mockContractAddress)).toThrowError(RpcUrlsEmpty); }); }); describe("getCurrentEpoch", () => {