report: simplify option checking

Also update the code for house style.

PR-URL: https://github.com/nodejs/node/pull/25597
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
This commit is contained in:
cjihrig 2019-01-20 17:43:53 -05:00
parent 5003314e5a
commit a0223378b2
No known key found for this signature in database
GPG Key ID: 7434390BDBE9B9C5

View File

@ -36,29 +36,45 @@ void PerProcessOptions::CheckOptions(std::vector<std::string>* errors) {
void PerIsolateOptions::CheckOptions(std::vector<std::string>* errors) {
per_env->CheckOptions(errors);
#ifdef NODE_REPORT
if (!report_directory.empty() && !per_env->experimental_report)
if (per_env->experimental_report)
return;
if (!report_directory.empty()) {
errors->push_back("--diagnostic-report-directory option is valid only when "
"--experimental-report is set");
if (!report_filename.empty() && !per_env->experimental_report)
}
if (!report_filename.empty()) {
errors->push_back("--diagnostic-report-filename option is valid only when "
"--experimental-report is set");
if (!report_signal.empty() && !per_env->experimental_report)
}
if (!report_signal.empty()) {
errors->push_back("--diagnostic-report-signal option is valid only when "
"--experimental-report is set");
if (report_on_fatalerror && !per_env->experimental_report)
}
if (report_on_fatalerror) {
errors->push_back(
"--diagnostic-report-on-fatalerror option is valid only when "
"--experimental-report is set");
if (report_on_signal && !per_env->experimental_report)
}
if (report_on_signal) {
errors->push_back("--diagnostic-report-on-signal option is valid only when "
"--experimental-report is set");
if (report_uncaught_exception && !per_env->experimental_report)
}
if (report_uncaught_exception) {
errors->push_back(
"--diagnostic-report-uncaught-exception option is valid only when "
"--experimental-report is set");
if (report_verbose && !per_env->experimental_report)
}
if (report_verbose) {
errors->push_back("--diagnostic-report-verbose option is valid only when "
"--experimental-report is set");
}
#endif // NODE_REPORT
}