-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error message in types assert #7001
Conversation
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/6144/ |
eaa129a
to
293ffee
Compare
@@ -18,7 +18,7 @@ import is from "../../validators/is"; | |||
function assert(type: string, node: Object, opts?: Object): void { | |||
if (!is(type, node, opts)) { | |||
throw new Error( | |||
\`Expected type "\${type}" with option \${JSON.stringify(opts)}\`, | |||
\`Expected type "\${type}" with option \${JSON.stringify(opts)}, but instead got "\${node.type}".\`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you break this line like in the generated file? Otherwise we will need to make fix
every time that it is recreated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can for consistency sake, but the generated files are auto "prettified" via:
https://github.com/babel/babel/blob/master/packages/babel-types/scripts/utils/formatCode.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah ok, nevermind then
From our slack convo, minor but improves the error message a bit.