Reputation: 1253
I am using OpenCV 2.4.9 and Visual C++ 2017. I am writing video and for testing purposes tried to write a frame on a full disk.
I did
try {
video_writer << frame;
} catch (cv::Exception& ex) {
// Handle exception
} catch (std::exception &e){
// Handle exception
} catch (const std::runtime_error& error) {
// Handle runtime error
}
on a full disk and hoped to be able to catch an exception. However I get a runtime error by the Microsoft Visual C++ Runtime Library
stating "This application has requested the runtime to terminate it in an unusual way."
How would I catch this?
Upvotes: 0
Views: 333
Reputation: 2357
OpenCV uses abort()
to notify about that issue. Since abort sends SIGABRT
which is not a c++ exception, but rather a signal
- you can't catch it within try catch block.
Also SIGABRT
would cause your program to crash no matter what. You can still hook it and try to do some cleanups, but that won't stop program from terminating.
The only solution I met which would let you to work around that SIGABRT
is described HERE
Upvotes: 1