Vulkan-Samples icon indicating copy to clipboard operation
Vulkan-Samples copied to clipboard

Error Handling

Open TomAtkinsonArm opened this issue 2 years ago • 2 comments

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?

TomAtkinsonArm avatar Jul 26 '22 09:07 TomAtkinsonArm

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.

asuessenbach avatar Jul 28 '22 06:07 asuessenbach

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

TomAtkinsonArm avatar Sep 12 '22 17:09 TomAtkinsonArm

Resolved in future framework v2.0 changes

tomadamatkinson avatar Mar 11 '23 16:03 tomadamatkinson