diff --git a/ebos/eclgenericthresholdpressure.cc b/ebos/eclgenericthresholdpressure.cc index a0a6331a3..cf9963dc4 100644 --- a/ebos/eclgenericthresholdpressure.cc +++ b/ebos/eclgenericthresholdpressure.cc @@ -22,6 +22,7 @@ */ #include +#include #include #include @@ -120,10 +121,16 @@ finishInit() return; numEquilRegions_ = eclState_.getTableManager().getEqldims().getNumEquilRegions(); - if (numEquilRegions_ > 0xff) { + const decltype(numEquilRegions_) maxRegions = + std::numeric_limits>::max(); + + if (numEquilRegions_ > maxRegions) { // make sure that the index of an equilibration region can be stored in a // single byte - throw std::runtime_error("The maximum number of supported equilibration regions is 255!"); + OPM_THROW(std::invalid_argument, + (fmt::format("The maximum number of supported " + "equilibration regions by OPM flow is {}!", + maxRegions))); } // internalize the data specified using the EQLNUM keyword