-
Notifications
You must be signed in to change notification settings - Fork 422
Bad command-line for debugDiagnosticSeverity does not crashes Prepack anymore #2545
Conversation
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.
Thank you very much!
You're welcome, but I am not happy, that I am not passing some checks ... But the old code was passing |
src/prepack-cli.js
Outdated
arg === "FatalError" || arg === "RecoverableError" || arg === "Warning" || arg === "Information", | ||
`Invalid debugger diagnostic severity: ${arg}` | ||
); | ||
if (!DiagnosticSeverityValues.includes(arg)) { |
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.
Flow does not understand this test well enough to be know that the assignment in line 307 below is type safe. You can fix that by moving the deleted invariant to just before line 307.
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.
It was not necessary to insert that call of the invariant
method again, as I wanted to omit a method call which does not have any function.
I have added a flow type cast to the line and that fixed the flow type check.
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.
hermanventer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
This can be a possible fix for #2509
I have removed the
invariant
method call and added a value check as used for the invariantMode option.node lib/prepack-cli.js --debugDiagnosticSeverity foo
will now generate
Unsupported debugDiagnosticSeverity: foo