Change readme example to catch std::exception (#4)

There are two reasons for this change.

1) The C++ mantra "throw by value, catch by reference" still applies,
even when you're only specifically throwing std::system_error at this
time
2) Vulkan-Hpp is using C++ stdlib containers, such as std::string and
std::vector, which have their own exception specifications to consider.
The example provided may throw various exceptions, all of which derive
from std::exception, and many will not be std::system_error.

This is a serious issue in the readme simply because that snippet of
code will be the copy/pasted foundation of many projects which adopt
Vulkan-Hpp. We might as well try to avoid some common pitfalls of
exception handling.
This commit is contained in:
jeaye 2016-07-25 11:40:22 -07:00 committed by Markus Tavenrath
parent e1703832d8
commit 6740df4faf

View File

@ -170,7 +170,7 @@ Here are a few code examples:
device.allocateMemory(allocateInfo, nullptr);
}
catch (std::system_error e)
catch (const std::exception &e)
{
std::cerr << "Vulkan failure: " << e.what() << std::endl;
}
@ -223,4 +223,4 @@ NVIDIA is happy to review and consider pull requests for merging into the main t
way deemed appropriate. Due to the required paperwork please refrain from providing pull requests for simple changes and file an issue
describing a bug or the desired change instead.
* Not all pull requests can be or will be accepted. NVIDIA will close pull requests that it does not intend to merge.
* The modified files and any new files must include the unmodified NVIDIA copyright header seen at the top of all shipping files.
* The modified files and any new files must include the unmodified NVIDIA copyright header seen at the top of all shipping files.