Open Myoldmopar opened 4 years ago
@Myoldmopar Hmmm, that seems dangerous. Users could trip error messages that aren't intended to be fatal but have format errors lurking in them. Seems this should write a "report this as an issue" message and continue.
I agree. We shouldn't let this cause a simulation to fatal. The fmt::format_error
should be caught, as it currently is, but then instead of raising another format error, we should issue a warning as you suggested @mjwitte and continue.
@lefticus can you address this in your next IO change? Basically just change the nested throw
into a ShowWarning with the same content being passed in.
@Myoldmopar can do. I have a PR in the works right now I can push it to.
This was addressed in #7997 commit https://github.com/NREL/EnergyPlus/commit/8cc27ebbcaaade6c3561550461ab7bd0ebe8062c. Closing
@Myoldmopar @mitchute So, the changes we discussed this morning were done in https://github.com/NREL/EnergyPlus/commit/8cc27ebbcaaade6c3561550461ab7bd0ebe8062c but somewhere along the way they got stomped on?
Oh fun...
Copy-paste mistake probably...
Actually... IDK what happened. It's my fault either way.
state isn't passed in vprint, yet it's needed for ShowWarningError
If we don't want to throw EnergyPlus::FataError
, I suppose we can just write to the ostream (/ std::string return) that message fmt::format("Error with format, '{}', passed {} args", format_str, sizeof...(Args))
. Typically that'll occurr inside a call to ShowWarningError or else error so it should end up in the right place.
Issue overview
With the new formatting library, invalid format calls are handled nicely in a try catch block, and a severe error is issued, but no fatal is thrown. We just need to issue the severe and then call a fatal, or just call the fatal directly with the error message: