opm-common icon indicating copy to clipboard operation
opm-common copied to clipboard

ErrorGuard::~ErrorGuard should not terminate program

Open blattms opened this issue 2 years ago • 2 comments

It calls std::exit(1) if there are recorded warnings. Seems a surprising and IMHO unclean. Any particular reason for that?

blattms avatar Jul 20 '23 12:07 blattms

It calls std::exit(1) if there are recorded warnings.

Kind of. The call to exit is if there are recorded errors and their "action" is configured to be EXIT1 or DELAYED_EXIT1. This is supposed to happen only for very serious problems in the input which mean we're unable to continue the run. In an MPI run there should probably be a different mechanism to achieve the same result, but we can't pretend the situation doesn't exist.

bska avatar Jul 21 '23 07:07 bska

I don't think you need MPI to get into an awkward situation. We just need to throw an exception while the ErrorGuard with recorded errors is on the stack and that gets unwinded due to the exception.

blattms avatar Jul 21 '23 15:07 blattms