From: Frederic Suter Date: Mon, 18 Feb 2019 22:01:04 +0000 (+0100) Subject: add a StorageFailureException X-Git-Tag: v3_22~309 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/4141cd9660259caa66e2e9af10873e53402b4812?hp=49a75a876cd9b9284722a63f1b3a02d1283630e1;ds=sidebyside add a StorageFailureException --- diff --git a/include/simgrid/Exception.hpp b/include/simgrid/Exception.hpp index b414b15f8b..a0786a9df8 100644 --- a/include/simgrid/Exception.hpp +++ b/include/simgrid/Exception.hpp @@ -144,6 +144,16 @@ public: } }; +/** Exception raised when a storage fails */ +class StorageFailureException : public xbt_ex { +public: + StorageFailureException(simgrid::xbt::ThrowPoint throwpoint, std::string message) + : xbt_ex(std::move(throwpoint), std::move(message)) + { + category = io_error; + } +}; + /** Exception raised when something got canceled before completion */ class CancelException : public xbt_ex { public: diff --git a/src/kernel/activity/IoImpl.cpp b/src/kernel/activity/IoImpl.cpp index 0f8a3ed701..5fac5af006 100644 --- a/src/kernel/activity/IoImpl.cpp +++ b/src/kernel/activity/IoImpl.cpp @@ -43,6 +43,7 @@ void IoImpl::cancel() XBT_VERB("This exec %p is canceled", this); if (surf_action_ != nullptr) surf_action_->cancel(); + state_ = SIMIX_CANCELED; } double IoImpl::get_remaining() diff --git a/src/simix/smx_io.cpp b/src/simix/smx_io.cpp index 62e482f7c2..4b8ecbc42f 100644 --- a/src/simix/smx_io.cpp +++ b/src/simix/smx_io.cpp @@ -44,7 +44,8 @@ void SIMIX_io_finish(smx_activity_t synchro) /* do nothing, synchro done */ break; case SIMIX_FAILED: - SMX_EXCEPTION(simcall->issuer, io_error, 0, "IO failed"); + simcall->issuer->exception_ = + std::make_exception_ptr(simgrid::StorageFailureException(XBT_THROW_POINT, "Storage failed")); break; case SIMIX_CANCELED: simcall->issuer->exception_ =