Skip to content

Commit 33ae73b

Browse files
committed
Better error message
If the blob looks like it was base64 encoded, note this in the error message.
1 parent 5d14443 commit 33ae73b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/serialize/src/deserialize_factory.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export function deserializeFactory<Suite extends AlgorithmSuite> (
7777
const version = dataView.getUint8(0)
7878
const type = dataView.getUint8(1)
7979
/* Precondition: version and type must be the required values. */
80-
needs(version === 1 && type === 128, 'Malformed Header')
80+
needs(version === 1 && type === 128,
81+
version === 65 && type === 89 ? 'Malformed Header: This blob may be base64 encoded.' : 'Malformed Header.' )
8182

8283
const suiteId = <AlgorithmSuiteIdentifier>dataView.getUint16(2, false) // big endian
8384
/* Precondition: suiteId must match supported algorithm suite */

0 commit comments

Comments
 (0)