Skip to content

Commit

Permalink
Update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Oct 26, 2021
1 parent 12e0a0a commit c422321
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions packages/babel-generator/src/generators/types.ts
Expand Up @@ -246,8 +246,11 @@ export function TopicReference(this: Printer) {
this.token(topicToken);
} else {
const givenTopicTokenJSON = JSON.stringify(topicToken);
const message = `The "topicToken" generator option must be "#" (${givenTopicTokenJSON} received instead).`;
throw new Error(message);
const validTopics = Array.from(validTopicTokenSet, v => JSON.stringify(v));
throw new Error(
`The "topicToken" generator option must be one of ` +
`${validTopics.join(", ")} (${givenTopicTokenJSON} received instead).`,
);
}
}

Expand Down
@@ -1,5 +1,5 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]],
"topicToken": "invalid",
"throws": "The \"topicToken\" generator option must be \"#\" (\"invalid\" received instead)."
"throws": "The \"topicToken\" generator option must be one of \"^\", \"%\", \"#\" (\"invalid\" received instead)."
}
@@ -1,4 +1,4 @@
{
"plugins": [["pipelineOperator", { "proposal": "hack", "topicToken": "#" }]],
"throws": "The \"topicToken\" generator option must be \"#\" (undefined received instead)."
"throws": "The \"topicToken\" generator option must be one of \"^\", \"%\", \"#\" (undefined received instead)."
}
Expand Up @@ -2,6 +2,7 @@ var _ref, _ref2, _ref3;

const result = (_ref3 = -2.2 // -2.2
, (_ref2 = Math.floor(_ref3) // -3
, (_ref = () => Math.pow(_ref2, 5), _ref()))); // -243
, (_ref = () => Math.pow(_ref2, 5) // () => -243
, _ref()))); // -243

expect(result).toBe(-243);
Expand Up @@ -3,7 +3,8 @@ const result = () => {

return _ref3 = -2.2 // -2.2
, (_ref2 = Math.floor(_ref3) // -3
, (_ref = () => Math.pow(_ref2, 5), _ref()));
, (_ref = () => Math.pow(_ref2, 5) // () => -243
, _ref()));
}; // -243


Expand Down

0 comments on commit c422321

Please sign in to comment.