Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Bad command-line for debugDiagnosticSeverity does not crashes Prepack anymore #2545

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export const InvariantModeValues = [
"nativeLoggingHook+2",
"nativeLoggingHook+3",
];
export const DiagnosticSeverityValues = ["FatalError", "RecoverableError", "Warning", "Information"];

export type ReactOutputTypes = "create-element" | "jsx" | "bytecode";
export const ReactOutputValues = ["create-element", "jsx", "bytecode"];
Expand Down
5 changes: 5 additions & 0 deletions src/prepack-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
ReactOutputValues,
type InvariantModeTypes,
InvariantModeValues,
DiagnosticSeverityValues,
} from "./options.js";
import { type SerializedResult } from "./serializer/types.js";
import { TextPrinter } from "./utils/TextPrinter.js";
Expand Down Expand Up @@ -299,6 +300,10 @@ function run(
break;
case "debugDiagnosticSeverity":
arg = args.shift();
if (!DiagnosticSeverityValues.includes(arg)) {
console.error(`Unsupported debugDiagnosticSeverity: ${arg}`);
process.exit(1);
}
invariant(
arg === "FatalError" || arg === "RecoverableError" || arg === "Warning" || arg === "Information",
`Invalid debugger diagnostic severity: ${arg}`
Expand Down