Skip to content

Commit

Permalink
Improved console output on IPF fail
Browse files Browse the repository at this point in the history
Yes, I know the duplicate code should be consolidated.
  • Loading branch information
Vultraz committed Jun 28, 2017
1 parent d5058ca commit 5948783
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/image.cpp
Expand Up @@ -592,10 +592,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!
Expand Down Expand Up @@ -1358,10 +1365,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!
Expand Down

0 comments on commit 5948783

Please sign in to comment.