diff --git a/packages/util-dynamodb/src/convertToAttr.spec.ts b/packages/util-dynamodb/src/convertToAttr.spec.ts index 4c9f3a90f5768..eae38fb3efd19 100644 --- a/packages/util-dynamodb/src/convertToAttr.spec.ts +++ b/packages/util-dynamodb/src/convertToAttr.spec.ts @@ -63,13 +63,13 @@ describe("convertToAttr", () => { expect(() => { convertToAttr(num, { convertClassInstanceToMap }); - }).toThrowError(`${errorPrefix} Use BigInt.`); + }).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`); const BigIntConstructor = BigInt; (BigInt as any) = undefined; expect(() => { convertToAttr(num, { convertClassInstanceToMap }); - }).toThrowError(`${errorPrefix} Pass string value instead.`); + }).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`); BigInt = BigIntConstructor; }); }); @@ -81,13 +81,13 @@ describe("convertToAttr", () => { expect(() => { convertToAttr(num, { convertClassInstanceToMap }); - }).toThrowError(`${errorPrefix} Use BigInt.`); + }).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`); const BigIntConstructor = BigInt; (BigInt as any) = undefined; expect(() => { convertToAttr(num, { convertClassInstanceToMap }); - }).toThrowError(`${errorPrefix} Pass string value instead.`); + }).toThrowError(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`); BigInt = BigIntConstructor; }); }); diff --git a/packages/util-dynamodb/src/convertToAttr.ts b/packages/util-dynamodb/src/convertToAttr.ts index a617d21ca2156..415b7574ac87f 100644 --- a/packages/util-dynamodb/src/convertToAttr.ts +++ b/packages/util-dynamodb/src/convertToAttr.ts @@ -157,7 +157,7 @@ const convertToStringAttr = (data: string | String): { S: string } => ({ S: data const convertToBigIntAttr = (data: bigint): { N: string } => ({ N: data.toString() }); const validateBigIntAndThrow = (errorPrefix: string) => { - throw new Error(`${errorPrefix} ${typeof BigInt === "function" ? "Use BigInt." : "Pass string value instead."} `); + throw new Error(`${errorPrefix} Use NumberValue from @aws-sdk/lib-dynamodb.`); }; const convertToNumberAttr = (num: number | Number): { N: string } => {