Skip to content

Commit a866100

Browse files
committed
chore: improve error message
1 parent c895d3a commit a866100

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/parsers/binary_parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ function compile(fields, options, config) {
149149

150150
if (helpers.privateObjectProps.has(fields[i].name)) {
151151
throw new Error(
152-
`The field name (${fieldName}) cannot be the same as the property of a native object.`,
152+
`The field name (${fieldName}) can't be the same as an object's private property.`,
153153
);
154154
}
155155

lib/parsers/text_parser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ function compile(fields, options, config) {
154154

155155
if (helpers.privateObjectProps.has(fields[i].name)) {
156156
throw new Error(
157-
`The field name (${fieldName}) cannot be the same as the property of a native object.`,
157+
`The field name (${fieldName}) can't be the same as an object's private property.`,
158158
);
159159
}
160160

test/esm/unit/parsers/ensure-safe-binary-fields.test.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ blockedFields.forEach((fields) => {
1717
} catch (error) {
1818
assert.strictEqual(
1919
error.message,
20-
`The field name (${srcEscape(fields[0].name)}) cannot be the same as the property of a native object.`,
20+
`The field name (${srcEscape(fields[0].name)}) can't be the same as an object's private property.`,
2121
`Ensure safe ${fields[0].name}`,
2222
);
2323
}

test/esm/unit/parsers/ensure-safe-text-fields.test.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ blockedFields.forEach((fields) => {
1717
} catch (error) {
1818
assert.strictEqual(
1919
error.message,
20-
`The field name (${srcEscape(fields[0].name)}) cannot be the same as the property of a native object.`,
20+
`The field name (${srcEscape(fields[0].name)}) can't be the same as an object's private property.`,
2121
`Ensure safe ${fields[0].name}`,
2222
);
2323
}

0 commit comments

Comments
 (0)