The code below catches not only errors but also some warnings with some specific inputs. Is there any way to ignore all the warnings instead of checking them in the catch block? I know I can use +profile "*"
on terminal, but I have no idea about what to tackle it in C++.
try {
Blob buff = Blob(input, inLen);
pImage->read(buff);
} catch (Exception &error) {
cout << error.what() << endl;
delete(pImage);
return -1;
}
If I'm reading Exception.cpp correctly, Magick::Exception
is too generic. Try isolating the warnings from the errors.
try {
Magick::Blob buff = Magick::Blob(input, inLen);
pImage->read(buff);
} catch (Magick::Warning &warning) {
// Ignore, or log
} catch (Magick::Error &error) {
cout << error.what() << endl;
delete(pImage);
return -1;
}