/** 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 */
namespace simgrid {
namespace xbt {
+ImpossibleError::~ImpossibleError() = default;
+UnimplementedError::~UnimplementedError() = default;
+
void log_exception(e_xbt_log_priority_t prio, const char* context, std::exception const& exception)
{
try {
{
std::stringstream ss;
ss << file << ":" << line << ":" << func << ": The Impossible Did Happen (yet again). Please report this bug.";
- throw std::runtime_error(ss.str());
+ throw simgrid::xbt::ImpossibleError(ss.str());
}
void xbt_throw_unimplemented(const char* file, int line, const char* func)
{
std::stringstream ss;
ss << file << ":" << line << ":" << func << ": Feature unimplemented yet. Please report this bug.";
- throw std::runtime_error(ss.str());
+ throw simgrid::xbt::UnimplementedError(ss.str());
}