/** Create a ThrowPoint with (__FILE__, __LINE__, __func__) */
#define XBT_THROW_POINT \
::simgrid::xbt::ThrowPoint(__FILE__, __LINE__, __func__, simgrid::xbt::Backtrace(), xbt_procname(), xbt_getpid())
+
+class XBT_PUBLIC ImpossibleError : public std::logic_error {
+public:
+ explicit ImpossibleError(const std::string& arg) : std::logic_error(arg) {}
+ ~ImpossibleError();
+};
+
+class XBT_PUBLIC UnimplementedError : public std::logic_error {
+public:
+ explicit UnimplementedError(const std::string& arg) : std::logic_error(arg) {}
+ ~UnimplementedError();
+};
+
} // namespace xbt
/** Ancestor class of all SimGrid exception */
* @ref WithContextException base class. We should deprecate it and replace it
* with either C++ different exceptions or `std::system_error` which already
* provides this (category + error code) logic.
+ * TODO ^^
*
* @ingroup XBT_ex_c
*/
}
};
+/** Exception raised when a VM fails */
+class VmFailureException : public xbt_ex {
+public:
+ VmFailureException(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
+ : xbt_ex(std::move(throwpoint), std::move(message))
+ {
+ category = vm_error;
+ }
+};
+
/** Exception raised when something got canceled before completion */
class CancelException : public xbt_ex {
public:
}
};
+/** Exception raised when something is going wrong during the simulation tracing */
+class TracingError : public xbt_ex {
+public:
+ TracingError(simgrid::xbt::ThrowPoint&& throwpoint, std::string&& message)
+ : xbt_ex(std::move(throwpoint), std::move(message))
+ {
+ category = tracing_error;
+ }
+};
+
class XBT_PUBLIC ForcefulKillException {
/** @brief Exception launched to kill an actor; DO NOT BLOCK IT!
*
~ForcefulKillException();
const char* what() const noexcept { return msg_.c_str(); }
- static void do_throw();
- static bool try_n_catch(std::function<void(void)> try_block);
+ XBT_ATTRIB_NORETURN static void do_throw();
+ static bool try_n_catch(const std::function<void()>& try_block);
private:
std::string msg_ = std::string("Actor killed.");