-/** Exception raised when a timeout elapsed */
-class TimeoutException : public Exception {
-public:
- TimeoutException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
- : Exception(std::move(throwpoint), std::move(message))
- {
+#define DECLARE_SIMGRID_EXCEPTION(AnyException, ...) \
+ class AnyException : public Exception { \
+ public: \
+ using Exception::Exception; \
+ __VA_ARGS__ \
+ ~AnyException() override; \
+ XBT_ATTRIB_NORETURN void rethrow_nested(simgrid::xbt::ThrowPoint&& throwpoint, \
+ const std::string& message) const override \
+ { \
+ std::throw_with_nested(AnyException(std::move(throwpoint), message)); \
+ } \