Skip to content

Commit 296f142

Browse files
authored
fix: Return 400 on invalid wallet (#719)
1 parent fcc532c commit 296f142

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/utils/cache/getWallet.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import type { EVMWallet } from "@thirdweb-dev/wallets";
22
import { AwsKmsWallet } from "@thirdweb-dev/wallets/evm/wallets/aws-kms";
33
import { GcpKmsWallet } from "@thirdweb-dev/wallets/evm/wallets/gcp-kms";
4+
import { StatusCodes } from "http-status-codes";
45
import { getWalletDetails } from "../../db/wallets/getWalletDetails";
56
import type { PrismaTransaction } from "../../schema/prisma";
67
import { WalletType } from "../../schema/wallet";
8+
import { createCustomError } from "../../server/middleware/error";
79
import { splitAwsKmsArn } from "../../server/utils/wallets/awsKmsArn";
810
import { splitGcpKmsResourcePath } from "../../server/utils/wallets/gcpKmsResourcePath";
911
import { getLocalWallet } from "../../server/utils/wallets/getLocalWallet";
@@ -40,7 +42,11 @@ export const getWallet = async <TWallet extends EVMWallet>({
4042
});
4143

4244
if (!walletDetails) {
43-
throw new Error(`No configured wallet found with address ${walletAddress}`);
45+
throw createCustomError(
46+
`No configured wallet found with address ${walletAddress}`,
47+
StatusCodes.BAD_REQUEST,
48+
"BAD_REQUEST",
49+
);
4450
}
4551

4652
const config = await getConfig();

0 commit comments

Comments
 (0)