Skip to content

Commit 477689e

Browse files
committed
Add bounds to error message
1 parent ef69ccd commit 477689e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/encrypt-browser/src/encrypt.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export async function encrypt (
6363
{ suiteId, encryptionContext, frameLength = FRAME_LENGTH }: EncryptInput = {}
6464
): Promise<EncryptResult> {
6565
/* Precondition: The frameLength must be less than the maximum frame size for browser encryption. */
66-
needs(frameLength > 0 && Maximum.FRAME_SIZE >= frameLength, 'frameLength out of bounds')
66+
needs(frameLength > 0 && Maximum.FRAME_SIZE >= frameLength, `frameLength out of bounds: 0 > frameLength >= ${Maximum.FRAME_SIZE}`)
6767

6868
const backend = await getWebCryptoBackend()
6969
if (!backend) throw new Error('No supported crypto backend')

modules/encrypt-node/src/encrypt_stream.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function encryptStream (
5959
const { suiteId, context, frameLength = FRAME_LENGTH } = op
6060

6161
/* Precondition: The frameLength must be less than the maximum frame size Node.js stream. */
62-
needs(frameLength > 0 && Maximum.FRAME_SIZE >= frameLength, 'frameLength out of bounds')
62+
needs(frameLength > 0 && Maximum.FRAME_SIZE >= frameLength, `frameLength out of bounds: 0 > frameLength >= ${Maximum.FRAME_SIZE}` )
6363

6464
/* If the cmm is a Keyring, wrap it with NodeDefaultCryptographicMaterialsManager. */
6565
cmm = cmm instanceof KeyringNode

0 commit comments

Comments
 (0)