Let prepack CLI fail in the presence of recoverable errors. (#2522)

Summary:
Release notes: Let prepack CLI fail in the presence of recoverable errors.
Pull Request resolved: https://github.com/facebook/prepack/pull/2522

Reviewed By: trueadm

Differential Revision: D9615735

Pulled By: NTillmann

fbshipit-source-id: b90deb174b47f0b9b8886be41e7752eade99b916
This commit is contained in:
Nikolai Tillmann 2018-09-06 13:50:34 -07:00 committed by Facebook Github Bot
parent 4f0bce54c9
commit f319df5d8c

View File

@ -485,8 +485,9 @@ function run(
for (let compilerDiagnostic of compilerDiagnosticsList) printCompilerDiagnostic(compilerDiagnostic);
invariant(informations + warnings + recoverableErrors + fatalErrors > 0);
let plural = (count, word) => (count === 1 ? word : `${word}s`);
const success = fatalErrors === 0 && recoverableErrors === 0;
console.error(
`Prepack ${fatalErrors > 0 ? "failed" : "succeeded"}, reporting ${[
`Prepack ${success ? "succeeded" : "failed"}, reporting ${[
fatalErrors > 0 ? `${fatalErrors} ${plural(fatalErrors, "fatal error")}` : undefined,
recoverableErrors > 0 ? `${recoverableErrors} ${plural(recoverableErrors, "recoverable error")}` : undefined,
warnings > 0 ? `${warnings} ${plural(warnings, "warning")}` : undefined,
@ -496,7 +497,7 @@ function run(
.join(", ")}.`
);
return fatalErrors === 0;
return success;
}
let profiler;