Skip to content

Commit

Permalink
fix: Return 400 on invalid wallet (#719)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcoraven authored Oct 10, 2024
1 parent fcc532c commit 296f142
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/cache/getWallet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import type { EVMWallet } from "@thirdweb-dev/wallets";
import { AwsKmsWallet } from "@thirdweb-dev/wallets/evm/wallets/aws-kms";
import { GcpKmsWallet } from "@thirdweb-dev/wallets/evm/wallets/gcp-kms";
import { StatusCodes } from "http-status-codes";
import { getWalletDetails } from "../../db/wallets/getWalletDetails";
import type { PrismaTransaction } from "../../schema/prisma";
import { WalletType } from "../../schema/wallet";
import { createCustomError } from "../../server/middleware/error";
import { splitAwsKmsArn } from "../../server/utils/wallets/awsKmsArn";
import { splitGcpKmsResourcePath } from "../../server/utils/wallets/gcpKmsResourcePath";
import { getLocalWallet } from "../../server/utils/wallets/getLocalWallet";
Expand Down Expand Up @@ -40,7 +42,11 @@ export const getWallet = async <TWallet extends EVMWallet>({
});

if (!walletDetails) {
throw new Error(`No configured wallet found with address ${walletAddress}`);
throw createCustomError(
`No configured wallet found with address ${walletAddress}`,
StatusCodes.BAD_REQUEST,
"BAD_REQUEST",
);
}

const config = await getConfig();
Expand Down

0 comments on commit 296f142

Please sign in to comment.