exception handling

Added by Adonai Canez almost 11 years ago


I want to handle exceptions when the image file is locked, but try and catch is not working. What is wrong?

catch(Exiv2::Error& e){
std::cout << "Error" << std::endl;
catch(std::exception &e){
std::cout << "Error" << std::endl;

terminate called after throwing an instance of 'Exiv2::BasicError<char>'
what(): C:/Users/Adonai S. Canez/Desktop/20101211 - Pedal até Pedro Osório/DSCN6656.JPG: Failed to open file (w+b): Permission denied (errno = 13)

Replies (3)

RE: exception handling - Added by Mikayel Egibyan over 5 years ago

Has this been resolved? I am still getting this error for some multi frame tiff files.


RE: exception handling - Added by Robin Mills over 5 years ago

I don't think try/catch can save the situation here. I think you will have to use a signal handler. This is discussed here:

You'll see that, the user agreed with my judgement that Signal handlers are process wide and should be used by applications and not libraries.

Here's a discussion on Stack Overflow about the difference between exception handlers (a C++ feature) and signal handlers (a process feature).