Improved console output on IPF fail

Yes, I know the duplicate code should be consolidated.
This commit is contained in:
Charles Dang 2017-06-28 11:37:27 +11:00
parent 085bd42974
commit b746829692

View file

@ -644,10 +644,17 @@ static surface load_image_sub_file(const image::locator& loc)
try {
surf = (*mod)(surf);
} catch(const image::modification::imod_exception& e) {
std::ostringstream ss;
ss << "\n";
for(const std::string& mod : utils::parenthetical_split(loc.get_modifications(), '~')) {
ss << "\t" << mod << "\n";
}
ERR_CFG << "Failed to apply a modification to an image:\n"
<< "Image: " << loc.get_filename() << ".\n"
<< "Modifications: " << loc.get_modifications() << ".\n"
<< "Error: " << e.message;
<< "Image: " << loc.get_filename() << "\n"
<< "Modifications: " << ss.str() << "\n"
<< "Error: " << e.message << "\n";
}
// NOTE: do this *after* applying the mod or you'll get crashes!
@ -1455,10 +1462,17 @@ static texture create_texture_from_sub_file(const image::locator& loc)
try {
surf = (*mod)(surf);
} catch(const image::modification::imod_exception& e) {
std::ostringstream ss;
ss << "\n";
for(const std::string& mod : utils::parenthetical_split(loc.get_modifications(), '~')) {
ss << "\t" << mod << "\n";
}
ERR_CFG << "Failed to apply a modification to an image:\n"
<< "Image: " << loc.get_filename() << ".\n"
<< "Modifications: " << loc.get_modifications() << ".\n"
<< "Error: " << e.message;
<< "Image: " << loc.get_filename() << "\n"
<< "Modifications: " << ss.str() << "\n"
<< "Error: " << e.message << "\n";
}
// NOTE: do this *after* applying the mod or you'll get crashes!