| 25 | } |
| 26 | |
| 27 | int getIntEnvVarValueOrDefault(string name, int defaultValue) { |
| 28 | |
| 29 | string strValue = getEnvVarValue(name); |
| 30 | int intValue = defaultValue; |
| 31 | |
| 32 | // overwrite default only when passed variable is interpretable |
| 33 | try { |
| 34 | intValue = std::stoi(strValue); |
| 35 | } |
| 36 | catch (const std::out_of_range&) { } |
| 37 | catch (const std::invalid_argument&) { } |
| 38 | return intValue; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | /* |
no test coverage detected