Improved console output on IPF fail

Yes, I know the duplicate code should be consolidated.

(cherry-picked from commit b746829692b702b7c3fc83726c16b0c789ad8651)
This commit is contained in:
Charles Dang 2017-06-28 11:37:27 +11:00
parent 56406aeedc
commit 0546b5162f

View File

@ -625,10 +625,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!