mirror of
https://github.com/cuberite/TCLAP.git
synced 2025-08-03 09:47:05 -04:00
Don't catch exceptions by value.
Exceptions are polymorphic, catching by value may loose information.
This commit is contained in:
parent
f940a0777f
commit
0747261252
@ -13,7 +13,7 @@ int main() {
|
||||
ValueArg<string> nameArg("nx","name","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
|
||||
@ -21,7 +21,7 @@ int main() {
|
||||
ValueArg<string> nameArg(" ","name","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ int main() {
|
||||
ValueArg<string> nameArg("-","name","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ int main() {
|
||||
ValueArg<string> nameArg("--","name","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ int main() {
|
||||
ValueArg<string> nameArg("n"," ","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ int main() {
|
||||
ValueArg<string> nameArg("n","-","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
|
||||
@ -61,7 +61,7 @@ int main() {
|
||||
ValueArg<string> nameArg("n","--","Name to print",true,
|
||||
"homer","string");
|
||||
return EXIT_FAILURE;
|
||||
} catch(SpecificationException e) {
|
||||
} catch(SpecificationException &e) {
|
||||
cout << e.what() << std::endl; // Expected
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user