Only unknown exceptions (invalid memory access, etc) are not caught in debug mode.

This commit is contained in:
David Capello 2010-04-06 08:27:53 -03:00
parent 27c895732d
commit 055af25600
2 changed files with 18 additions and 27 deletions

View File

@ -147,11 +147,15 @@ void Context::execute_command(Command* command, Params* params)
catch (std::exception& e) {
console.printf("An error ocurred executing the command.\n\nDetails:\n%s", e.what());
}
#ifndef DEBUGMODE
catch (...) {
console.printf("An unknown error ocurred executing the command.\n"
"Please try again or report this bug.\n\n"
"Details: Unknown exception caught.");
"Please save your work, close the program, try it\n"
"again, and report this bug.\n\n"
"Details: Unknown exception caught. This can be bad\n"
"memory access, divison by zero, etc.");
}
#endif
}
void Context::on_add_sprite(Sprite* sprite)

View File

@ -60,36 +60,23 @@ public:
int vaca_main()
{
int status = 1; // 1 = error
Allegro allegro;
#ifndef DEBUGMODE
try {
#endif
Jinete jinete;
App app;
Allegro allegro;
#ifndef DEBUGMODE
try {
#endif
Jinete jinete;
App app;
status = app.run();
#ifndef DEBUGMODE
}
catch (jexception& e) {
e.show();
}
catch (std::exception& e) {
allegro_message(e.what());
}
catch (...) {
allegro_message("Uncaught exception");
}
status = app.run();
}
catch (jexception& e) {
e.show();
}
catch (std::exception& e) {
allegro_message(e.what());
}
#ifndef DEBUGMODE
catch (...) {
printf("Uncaught exception");
allegro_message("Uncaught exception");
}
#endif