Skip to content

Commit 1902196

Browse files
zshzbhkuhe
andauthored
fix: update error messge to NumberValue (#6579)
* fix: update error message to NumberValue --------- Co-authored-by: George Fu <[email protected]>
1 parent 25443cc commit 1902196

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: packages/util-dynamodb/src/convertToAttr.spec.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ describe("convertToAttr", () => {
6363

6464
expect(() => {
6565
convertToAttr(num, { convertClassInstanceToMap });
66-
}).toThrowError(`${errorPrefix} Use BigInt.`);
66+
}).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`);
6767

6868
const BigIntConstructor = BigInt;
6969
(BigInt as any) = undefined;
7070
expect(() => {
7171
convertToAttr(num, { convertClassInstanceToMap });
72-
}).toThrowError(`${errorPrefix} Pass string value instead.`);
72+
}).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`);
7373
BigInt = BigIntConstructor;
7474
});
7575
});
@@ -81,13 +81,13 @@ describe("convertToAttr", () => {
8181

8282
expect(() => {
8383
convertToAttr(num, { convertClassInstanceToMap });
84-
}).toThrowError(`${errorPrefix} Use BigInt.`);
84+
}).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`);
8585

8686
const BigIntConstructor = BigInt;
8787
(BigInt as any) = undefined;
8888
expect(() => {
8989
convertToAttr(num, { convertClassInstanceToMap });
90-
}).toThrowError(`${errorPrefix} Pass string value instead.`);
90+
}).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`);
9191
BigInt = BigIntConstructor;
9292
});
9393
});

Diff for: packages/util-dynamodb/src/convertToAttr.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const convertToStringAttr = (data: string | String): { S: string } => ({ S: data
157157
const convertToBigIntAttr = (data: bigint): { N: string } => ({ N: data.toString() });
158158

159159
const validateBigIntAndThrow = (errorPrefix: string) => {
160-
throw new Error(`${errorPrefix} ${typeof BigInt === "function" ? "Use BigInt." : "Pass string value instead."} `);
160+
throw new Error(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`);
161161
};
162162

163163
const convertToNumberAttr = (num: number | Number): { N: string } => {

0 commit comments

Comments
 (0)