Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add a StorageFailureException
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 18 Feb 2019 22:01:04 +0000 (23:01 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Mon, 18 Feb 2019 22:01:04 +0000 (23:01 +0100)
include/simgrid/Exception.hpp
src/kernel/activity/IoImpl.cpp
src/simix/smx_io.cpp

index b414b15..a0786a9 100644 (file)
@@ -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:
 /** Exception raised when something got canceled before completion */
 class CancelException : public xbt_ex {
 public:
index 0f8a3ed..5fac5af 100644 (file)
@@ -43,6 +43,7 @@ void IoImpl::cancel()
   XBT_VERB("This exec %p is canceled", this);
   if (surf_action_ != nullptr)
     surf_action_->cancel();
   XBT_VERB("This exec %p is canceled", this);
   if (surf_action_ != nullptr)
     surf_action_->cancel();
+  state_ = SIMIX_CANCELED;
 }
 
 double IoImpl::get_remaining()
 }
 
 double IoImpl::get_remaining()
index 62e482f..4b8ecbc 100644 (file)
@@ -44,7 +44,8 @@ void SIMIX_io_finish(smx_activity_t synchro)
         /* do nothing, synchro done */
         break;
       case SIMIX_FAILED:
         /* 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_ =
         break;
       case SIMIX_CANCELED:
         simcall->issuer->exception_ =