fix(marshal): Consistently quote "@qclass" in error messages
MODIFY
packages/marshal/src/encodeToCapData.js
packages/marshal/src/encodeToCapData.js
@@ -345,7 +345,7 @@ export const makeDecodeFromCapData = ({
assert.typeof(
qclass,
'string',
- X`invalid qclass typeof ${q(typeof qclass)}`,
+ X`invalid ${q(QCLASS)} typeof ${q(typeof qclass)}`,
);
switch (qclass) {
// Encoding of primitives not handled by JSON

MODIFY
packages/marshal/test/test-marshal-capdata.js
packages/marshal/test/test-marshal-capdata.js
@@ -290,7 +290,9 @@ test('passStyleOf null is "null"', t => {
test('mal-formed @qclass', t => {
const m = makeTestMarshal();
const uns = body => m.unserialize({ body, slots: [] });
- t.throws(() => uns('{"@qclass": 0}'), { message: /invalid qclass/ });
+ t.throws(() => uns('{"@qclass": 0}'), {
+ message: /invalid "@qclass" typeof "number"*/,
+ });
});
test('records', t => {

MODIFY
packages/marshal/test/test-marshal-stringify.js
packages/marshal/test/test-marshal-stringify.js
@@ -52,7 +52,7 @@ test('marshal parse errors', t => {
message: /Unexpected token X in JSON at position 0*/,
});
t.throws(() => parse('{"@qclass":8}'), {
- message: /invalid qclass typeof "number"*/,
+ message: /invalid "@qclass" typeof "number"*/,
});
t.throws(() => parse('{"@qclass":"bogus"}'), {
message: /unrecognized "@qclass" "bogus"*/,

fix(marshal): Consistently quote "@qclass" in error messages