X-Git-Url: https://git.dlugolecki.net.pl/?p=command.git;a=blobdiff_plain;f=include%2Fcommand.h;h=0cbb3d6eba84d4a02c1391f316f710de189c1514;hp=98db4296656221361f8579f028a410417b560ac8;hb=e516b9282a0d716b8770bdf58af13cfe0843fa92;hpb=1db559f7394bb6384c7f9dddc8de3927bcb263c5 diff --git a/include/command.h b/include/command.h index 98db429..0cbb3d6 100644 --- a/include/command.h +++ b/include/command.h @@ -6,6 +6,7 @@ #include #include "parameter.h" +#include "exception/missingRequiredParameter.h" namespace command { /** @@ -29,11 +30,11 @@ namespace command { try { matchArguments(argc, argv); } - catch(std::invalid_argument exception) { + catch(const std::invalid_argument & exception) { releaseMemory(); throw; } - catch(std::logic_error exception) { + catch(const std::logic_error & exception) { releaseMemory(); throw; } @@ -60,7 +61,7 @@ namespace command { } for(Parameter *param : parameters) { if (param->isRequired() && !param->isUsed()) { - throw std::logic_error(param->describe() + " is required but it was not passed"); + throw MissingRequiredParameter(param->describe() + " is required but it was not passed"); } } }