X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/dd0b1cc786a3c1de8f768defdf419d74028a141a..950b9d175a7966b91adf53b74745ce4e6e5da5f9:/include/simgrid/Exception.hpp diff --git a/include/simgrid/Exception.hpp b/include/simgrid/Exception.hpp index 13cbc85f23..9ea27ab704 100644 --- a/include/simgrid/Exception.hpp +++ b/include/simgrid/Exception.hpp @@ -11,19 +11,12 @@ * Defines all possible exception that could occur in a SimGrid library. */ -#include -#include -#include -#include -#include - -#include #include -#include #include -#include -#include // xbt_procname -#include // xbt_getpid + +#include +#include +#include namespace simgrid { namespace xbt { @@ -61,7 +54,7 @@ public: /** Ancestor class of all SimGrid exception */ class Exception : public std::runtime_error { public: - Exception(simgrid::xbt::ThrowPoint throwpoint, const char* message) + Exception(simgrid::xbt::ThrowPoint throwpoint, std::string message) : std::runtime_error(message), throwpoint_(throwpoint) { } @@ -95,7 +88,7 @@ public: * @param throwpoint Throw point (use XBT_THROW_POINT) * @param message Exception message */ - xbt_ex(simgrid::xbt::ThrowPoint throwpoint, const char* message) : simgrid::Exception(throwpoint, message) {} + xbt_ex(simgrid::xbt::ThrowPoint throwpoint, std::string message) : simgrid::Exception(throwpoint, message) {} ~xbt_ex(); // DO NOT define it here -- see ex.cpp for a rationale @@ -110,19 +103,35 @@ namespace simgrid { /** Exception raised when a timeout elapsed */ class TimeoutError : public xbt_ex { +public: + TimeoutError(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message) + { + category = timeout_error; + } }; /** Exception raised when an host fails */ class HostFailureException : public xbt_ex { +public: + HostFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message) + { + category = host_error; + } }; /** Exception raised when a communication fails because of the network */ class NetworkFailureException : public xbt_ex { +public: + NetworkFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message) + { + category = network_error; + } }; /** Exception raised when something got canceled before completion */ class CancelException : public xbt_ex { }; + } // namespace simgrid #endif