[Cin] openexr error handling
Andrew Randrianasulu
randrianasulu at gmail.com
Wed Aug 30 19:20:41 CEST 2023
According to this page
https://openexr.com/en/latest/ReadingAndWritingImageFiles.html
====
You may have noticed that in the example above, there are no explicit
checks to verify that writing the file actually succeeded. If the
OpenEXR library detects an error, it throws a C++ exception instead of
returning a C-style error code. With exceptions, error handling tends
to be easier to get right than with error return values. For instance,
a program that calls our writeRgba1() function can handle all possible
error conditions with a single try/catch block:
1 try
2 {
3 writeRgba1 (fileName, pixels, width, height);
4 }
5 catch (const std::exception &exc)
6 {
7 std::cerr << exc.what() << std::endl;
8 }
=====
I guess this mechanism was not very refined in c++98, so it was not
used in Cinelerra. Then come I and made EXR one of choices in
background render (where error handling apparently matters). I hope
one call per frame will not slow us down much .... and better slower
than crash?
More information about the Cin
mailing list