Vulkan-Samples
Vulkan-Samples copied to clipboard
Error Handling
We should use this thread to further discuss error handling.
Currently, we return an error like so:
if(auto err = some_function()) {
// handle error
}
@asuessenbach would you be able to make a PR showing how we can use exceptions?
I have ported the filesystem files from StackErrorPtr
to exceptions, by essentially just replacing them with a std::runtime_error
and adjust their usage.
One could argue, though, whether, for example, trying to read a chunk of data from a non-existent file, or trying to read beyond the file size actually are runtime errors or in fact programmer's errors. (I think, we can assume the files used here are constant!)
But in either case, it should show the principal usage.
This issue is left open to track the remaining error handling comments.
We would like to use a macro to help simplify throwing errors. @gpx1000 suggestion.
Does it make sense to make this a macro and use something like: #define ERROR_STR(...) (( FILE ":" LINE " " VA_ARGS))
We would also like to remove the usage of hard coded file paths. Preferably cutting down the file path length generated by __FILE__
as much as possible. @gary-sweet suggestion
Resolved in future framework v2.0 changes