Capture des exceptions pour la lecture du fichier
This commit is contained in:
parent
25287bcc4b
commit
a8e325cb20
|
@ -12,6 +12,7 @@ int main() {
|
||||||
Manager manager;
|
Manager manager;
|
||||||
std::shared_ptr<Game> game = std::shared_ptr<Game>(new Game(manager));
|
std::shared_ptr<Game> game = std::shared_ptr<Game>(new Game(manager));
|
||||||
|
|
||||||
|
try {
|
||||||
// ouverture du niveau
|
// ouverture du niveau
|
||||||
std::ifstream file;
|
std::ifstream file;
|
||||||
file.open("./levels/level1.dat", std::ios::binary | std::ios::in);
|
file.open("./levels/level1.dat", std::ios::binary | std::ios::in);
|
||||||
|
@ -19,11 +20,8 @@ int main() {
|
||||||
file.close();
|
file.close();
|
||||||
|
|
||||||
manager.setView(game);
|
manager.setView(game);
|
||||||
|
|
||||||
try {
|
|
||||||
manager.start();
|
manager.start();
|
||||||
} catch (const std::exception& exception) {
|
} 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 << "Le programme a quitté après une erreur d'exécution." << std::endl;
|
||||||
std::cerr << exception.what() << std::endl;
|
std::cerr << exception.what() << std::endl;
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
|
|
Loading…
Reference in New Issue