remove the undefined invariant violation (#2106)

Summary:
Release Note: none

This is regarding #2072

Instead of spitting back Invariant Violation: undefined in this case, it will give back the trace error.

Also the Invariant Violation: undefined is misleading. The undefined is coming from the invariant format parameter when format isn't supplied. The fix is to add an empty string to format so it won't show undefined.

Questions: would you want to separate that throw into a separate util method like invariant?
Closes https://github.com/facebook/prepack/pull/2106

Differential Revision: D8394381

Pulled By: NTillmann

fbshipit-source-id: 3ed418c335b7db6d88bb1cca5dcc9ac69fed6b5d
This commit is contained in:
Victor Hom 2018-06-13 00:57:13 -07:00 committed by Facebook Github Bot
parent e8bbe014af
commit 5b513adc84

View File

@ -9,7 +9,7 @@
/* @flow strict */
export default function invariant(condition: boolean, format: string): void {
export default function invariant(condition: boolean, format: string = ""): void {
if (condition) return;
const message = `${format}
This is likely a bug in Prepack, not your code. Feel free to open an issue on GitHub.`;