Skip to content

Commit 08b7e45

Browse files
committed
fix(marshal): Consistently quote "@qclass" in error messages
1 parent 6f054cb commit 08b7e45

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

packages/marshal/src/encodeToCapData.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ export const makeDecodeFromCapData = ({
345345
assert.typeof(
346346
qclass,
347347
'string',
348-
X`invalid qclass typeof ${q(typeof qclass)}`,
348+
X`invalid ${q(QCLASS)} typeof ${q(typeof qclass)}`,
349349
);
350350
switch (qclass) {
351351
// Encoding of primitives not handled by JSON

packages/marshal/test/test-marshal-capdata.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,9 @@ test('passStyleOf null is "null"', t => {
290290
test('mal-formed @qclass', t => {
291291
const m = makeTestMarshal();
292292
const uns = body => m.unserialize({ body, slots: [] });
293-
t.throws(() => uns('{"@qclass": 0}'), { message: /invalid qclass/ });
293+
t.throws(() => uns('{"@qclass": 0}'), {
294+
message: /invalid "@qclass" typeof "number"*/,
295+
});
294296
});
295297

296298
test('records', t => {

packages/marshal/test/test-marshal-stringify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ test('marshal parse errors', t => {
5252
message: /Unexpected token X in JSON at position 0*/,
5353
});
5454
t.throws(() => parse('{"@qclass":8}'), {
55-
message: /invalid qclass typeof "number"*/,
55+
message: /invalid "@qclass" typeof "number"*/,
5656
});
5757
t.throws(() => parse('{"@qclass":"bogus"}'), {
5858
message: /unrecognized "@qclass" "bogus"*/,

0 commit comments

Comments
 (0)