Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Const + simplification for jedule::Container::get_child_position.
[simgrid.git] / include / simgrid / Exception.hpp
index e0dc7b4..613ca5a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2018-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2018-2020. 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. */
@@ -13,6 +13,7 @@
 
 #include <xbt/backtrace.hpp>
 #include <xbt/ex.h>
+#include <xbt/string.hpp>
 
 #include <atomic>
 #include <functional>
@@ -63,6 +64,12 @@ public:
   ~ImpossibleError();
 };
 
+class XBT_PUBLIC InitializationError : public std::logic_error {
+public:
+  explicit InitializationError(const std::string& arg) : std::logic_error(arg) {}
+  ~InitializationError();
+};
+
 class XBT_PUBLIC UnimplementedError : public std::logic_error {
 public:
   explicit UnimplementedError(const std::string& arg) : std::logic_error(arg) {}
@@ -101,7 +108,7 @@ public:
   }
 };
 
-XBT_ATTRIB_DEPRECATED_v327("Please use simgrid::TimeoutException") typedef TimeoutException TimeoutError;
+XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::TimeoutException") typedef TimeoutException TimeoutError;
 
 /** Exception raised when a host fails */
 class HostFailureException : public Exception {
@@ -157,6 +164,15 @@ public:
   }
 };
 
+/** Exception raised when something is going wrong during the parsing of XML files */
+class ParseError : public Exception {
+public:
+  ParseError(const std::string& file, int line, const std::string& msg)
+      : Exception(XBT_THROW_POINT, xbt::string_printf("Parse error at %s:%d: %s", file.c_str(), line, msg.c_str()))
+  {
+  }
+};
+
 class XBT_PUBLIC ForcefulKillException {
   /** @brief Exception launched to kill an actor; DO NOT BLOCK IT!
    *
@@ -197,6 +213,6 @@ private:
 
 } // namespace simgrid
 
-XBT_ATTRIB_DEPRECATED_v327("Please use simgrid::Exception") typedef simgrid::Exception xbt_ex;
+XBT_ATTRIB_DEPRECATED_v328("Please use simgrid::Exception") typedef simgrid::Exception xbt_ex;
 
 #endif