Skip to content

Commit

Permalink
fix: exception naming
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkenj1 committed Jul 25, 2024
1 parent 8b6d09f commit ebdf787
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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";
}
}
4 changes: 2 additions & 2 deletions packages/automated-dispute/src/protocolProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions packages/automated-dispute/tests/protocolProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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", () => {
Expand Down

0 comments on commit ebdf787

Please sign in to comment.