From a8e325cb2042faf10e344e7bd9c892f6bab7171c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matt=C3=A9o=20Delabre?= Date: Sat, 2 Apr 2016 15:06:21 +0200 Subject: [PATCH] Capture des exceptions pour la lecture du fichier --- src/main.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 69c778e..ccdfe7d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -12,18 +12,16 @@ int main() { Manager manager; std::shared_ptr game = std::shared_ptr(new Game(manager)); - // ouverture du niveau - std::ifstream file; - file.open("./levels/level1.dat", std::ios::binary | std::ios::in); - game->load(file); - file.close(); - - manager.setView(game); - try { + // ouverture du niveau + std::ifstream file; + file.open("./levels/level1.dat", std::ios::binary | std::ios::in); + game->load(file); + file.close(); + + manager.setView(game); manager.start(); } 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;