- Exception() : std::runtime_error("") {}
- Exception(const char* message) : std::runtime_error(message) {}
+ Exception(simgrid::xbt::ThrowPoint&& throwpoint, const std::string& message)
+ : std::runtime_error(message), throwpoint_(std::move(throwpoint))
+ {
+ }
+ Exception(const Exception&) = default;
+ Exception(Exception&&) noexcept = default;
+ ~Exception() override; // DO NOT define it here -- see Exception.cpp for a rationale
+
+ /** Return the information about where the exception was thrown */
+ xbt::ThrowPoint const& throw_point() const { return throwpoint_; }
+
+ /** Allow to carry a value (used by testany/waitany) */
+ ssize_t get_value() const { return value_; }
+ void set_value(ssize_t value) { value_ = value; }
+
+ std::string resolve_backtrace() const { return throwpoint_.backtrace_.resolve(); }
+
+ virtual void rethrow_nested(simgrid::xbt::ThrowPoint&& throwpoint, const std::string& message) const
+ {
+ std::throw_with_nested(Exception(std::move(throwpoint), message));
+ }
+
+private:
+ xbt::ThrowPoint throwpoint_;
+ ssize_t value_ = 0;