Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Easy Sonar smells.
[simgrid.git] / teshsuite / s4u / issue71 / issue71.cpp
index 1e9481f..6333844 100644 (file)
@@ -1,10 +1,11 @@
-/* Copyright (c) 2021. The SimGrid Team. All rights reserved.               */
+/* Copyright (c) 2021-2022. The SimGrid Team. All rights reserved.               */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include <simgrid/s4u.hpp>
 #include <vector>
+#include <iostream>
 
 static void runner()
 {
@@ -30,10 +31,14 @@ int main(int argc, char* argv[])
              argv[0], argv[0]);
 
   const char* platform_file = argv[1];
-  e.load_platform(platform_file);
 
-  simgrid::s4u::Actor::create("actor", e.host_by_name("c1_0"), runner);
+  try {
+    e.load_platform(platform_file);
+    simgrid::s4u::Actor::create("actor", e.host_by_name("c1_0"), runner);
+    e.run();
+  } catch (const simgrid::AssertionError& e) {
+    std::cout << e.what() << "\n";
+  }
 
-  e.run();
   return 0;
 }