Prise en charge propre des exceptions

This commit is contained in:
Mattéo Delabre 2016-03-24 20:11:25 +01:00
parent 586ba7ca10
commit fbc43a400b
2 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@
#include "block.hpp"
#include "engine.hpp"
#include "constants.hpp"
#include <cstdlib>
#include <iostream>
int main() {
@ -62,6 +63,14 @@ int main() {
engine.addObject(block21);
engine.addObject(block22);
try {
engine.start();
return 0;
} catch (const std::exception& exception) {
std::cerr << std::endl;
std::cerr << "Le programme a quitté après une erreur d'exécution." << std::endl;
std::cerr << exception.what() << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}