Skip to content

Commit 7ca94fb

Browse files
committed
fix: error message with getLens()
1 parent 2b6839b commit 7ca94fb

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/lib/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ revLookup['-'.charCodeAt(0)] = 62
1313
revLookup['_'.charCodeAt(0)] = 63
1414

1515
export const ErrorMsg = {
16-
base64Invalidlength: 'Invalid string. Length must be a multiple of 4',
16+
base64Invalidlength: 'Invalid string. Length must be a multiple of 4 and positive',
1717
encodeInvalidParam: 'Invalid value of parameter of encode(), should be string|number|bigint',
1818
fromArrayBufferInvalidParam: 'Invalid input, should be ArrayBuffer or Uint8Array',
1919
notString: 'Invalid value of parameter, should be string',

src/lib/to_buffer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function getLens(input: string): [number, number] {
5151
const len = input.length
5252

5353
if (len & 3) {
54-
throw new Error(ErrorMsg.encodeInvalidParam)
54+
throw new Error(ErrorMsg.base64Invalidlength)
5555
}
5656

5757
// Trim off extra bytes after placeholder bytes are found

0 commit comments

Comments
 (0)