/** 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)
{
}
* @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
/** Exception raised when an host fails */
class HostFailureException : public xbt_ex {
public:
- HostFailureException(simgrid::xbt::ThrowPoint throwpoint, const char* message) : xbt_ex(throwpoint, message)
+ HostFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message) : xbt_ex(throwpoint, message)
{
category = host_error;
}
smx_activity_t ActorImpl::sleep(double duration)
{
if (host_->is_off())
- THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host_->get_cname());
+ throw new simgrid::HostFailureException(XBT_THROW_POINT,
+ std::string("Host ") + std::string(host_->get_cname())+" failed, you cannot sleep there.");
simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
synchro->host = host_;
void _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file, int line, const char* func)
{
- xbt_ex e(simgrid::xbt::ThrowPoint(file, line, func, simgrid::xbt::backtrace(), xbt_procname(), xbt_getpid()),
- message);
+ xbt_ex e(simgrid::xbt::ThrowPoint(XBT_THROW_POINT), message);
xbt_free(message);
e.category = errcat;
e.value = value;