Exit gracefully if integer conversion in CLI parser fails

This commit is contained in:
Steffen Winter
2025-06-01 23:42:47 +02:00
committed by Steffen
parent 6d4bcacfee
commit d429bcfe82

View File

@@ -124,6 +124,9 @@ namespace Cli {
} catch (std::invalid_argument& e) {
error("Preset must be a positive number");
return OrRetCode { 1 };
} catch (std::out_of_range& e) {
error(fmt::format("Preset argument is out of range: {}", arg.data()));
return OrRetCode { 1 };
}
continue;
}
@@ -141,6 +144,9 @@ namespace Cli {
} catch (std::invalid_argument& e) {
error("Update must be a positive number");
return OrRetCode { 1 };
} catch(std::out_of_range& e) {
error(fmt::format("Update argument is out of range: {}", arg.data()));
return OrRetCode { 1 };
}
continue;
}