diff --git a/src/EnergyPlus/UtilityRoutines.cc b/src/EnergyPlus/UtilityRoutines.cc index 0bc9d71a941..57c40b441ee 100644 --- a/src/EnergyPlus/UtilityRoutines.cc +++ b/src/EnergyPlus/UtilityRoutines.cc @@ -866,18 +866,19 @@ bool env_var_on(std::string const &env_var_str) return ((!env_var_str.empty()) && is_any_of(env_var_str[0], "YyTt")); } -void emitErrorMessage(EnergyPlusData &state, int idOne, std::string const &msg, bool shouldFatal) +void emitErrorMessage(EnergyPlusData &state, [[maybe_unused]] ErrorMessageCategory category, std::string const &msg, bool shouldFatal) { - (void)idOne; if (!shouldFatal) { ShowSevereError(state, msg); } else { // should fatal ShowFatalError(state, msg); } } -void emitErrorMessages(EnergyPlusData &state, int idOne, std::initializer_list const &msgs, bool shouldFatal) +void emitErrorMessages(EnergyPlusData &state, + [[maybe_unused]] ErrorMessageCategory category, + std::initializer_list const &msgs, + bool shouldFatal) { - (void)idOne; for (auto msg = msgs.begin(); msg != msgs.end(); ++msg) { if (msg == msgs.begin()) { ShowSevereError(state, *msg); @@ -888,18 +889,19 @@ void emitErrorMessages(EnergyPlusData &state, int idOne, std::initializer_list const &msgs, bool const countAsError) +void emitWarningMessages(EnergyPlusData &state, + [[maybe_unused]] ErrorMessageCategory category, + std::initializer_list const &msgs, + bool const countAsError) { - (void)idOne; for (auto msg = msgs.begin(); msg != msgs.end(); ++msg) { if (msg == msgs.begin()) { if (countAsError) { // ideally this path goes away and we just have distinct warnings and errors diff --git a/src/EnergyPlus/UtilityRoutines.hh b/src/EnergyPlus/UtilityRoutines.hh index 29ef3e4335e..e08fe31d4eb 100644 --- a/src/EnergyPlus/UtilityRoutines.hh +++ b/src/EnergyPlus/UtilityRoutines.hh @@ -132,10 +132,34 @@ bool env_var_on(std::string const &env_var_str); using OptionalOutputFileRef = std::optional>; -void emitErrorMessage(EnergyPlusData &state, int idOne, std::string const &msg, bool shouldFatal); -void emitErrorMessages(EnergyPlusData &state, int idOne, std::initializer_list const &msgs, bool shouldFatal); -void emitWarningMessage(EnergyPlusData &state, int idOne, std::string const &msg, bool countAsError = false); -void emitWarningMessages(EnergyPlusData &state, int idOne, std::initializer_list const &msgs, bool countAsError = false); +enum class ErrorMessageCategory +{ + Invalid = -1, + Unclassified, + Input_invalid, + Input_field_not_found, + Input_field_blank, + Input_object_not_found, + Input_cannot_find_object, + Input_topology_problem, + Input_unused, + Input_fatal, + Runtime_general, + Runtime_flow_out_of_range, + Runtime_temp_out_of_range, + Runtime_airflow_network, + Fatal_general, + Developer_general, + Developer_invalid_index, + Num +}; +void emitErrorMessage(EnergyPlusData &state, ErrorMessageCategory category, std::string const &msg, bool shouldFatal); +void emitErrorMessages(EnergyPlusData &state, ErrorMessageCategory category, std::initializer_list const &msgs, bool shouldFatal); +void emitWarningMessage(EnergyPlusData &state, ErrorMessageCategory category, std::string const &msg, bool countAsError = false); +void emitWarningMessages(EnergyPlusData &state, + ErrorMessageCategory category, + std::initializer_list const &msgs, + bool countAsError = false); void ShowFatalError(EnergyPlusData &state, std::string const &ErrorMessage, OptionalOutputFileRef OutUnit1 = {}, OptionalOutputFileRef OutUnit2 = {});