Skip to content

Commit 66cc06a

Browse files
committed
Stringify invalid transfer method when creating error object
1 parent 30085fa commit 66cc06a

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

packages/smart-accounts-kit-x402/src/x402Client.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,13 @@ export class x402Erc7710Client {
9696
);
9797
}
9898

99+
const invalidAssetTransferMethod =
100+
typeof assetTransferMethod === 'string'
101+
? `"${assetTransferMethod}"`
102+
: JSON.stringify(assetTransferMethod);
103+
99104
throw new Error(
100-
`x402Erc7710Client can only process assetTransferMethod "erc7710". Received: ${
101-
typeof assetTransferMethod === 'string'
102-
? `"${assetTransferMethod}"`
103-
: 'undefined'
104-
}`,
105+
`x402Erc7710Client can only process assetTransferMethod "erc7710". Received: ${invalidAssetTransferMethod}$`,
105106
);
106107
}
107108

0 commit comments

Comments
 (0)