- } else if (simcall_host_get_state(SIMIX_host_self()) == 0) {
- /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- simdata->comm = NULL;
- simdata->compute = NULL;
-#ifdef HAVE_TRACING
- TRACE_msg_task_execute_end(task);
-#endif
- MSG_RETURN(MSG_HOST_FAILURE);
- } else {
- /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
- simdata->comm = NULL;
- simdata->compute = NULL;
-#ifdef HAVE_TRACING
- TRACE_msg_task_execute_end(task);
-#endif
- MSG_RETURN(MSG_TASK_CANCELED);
+ }
+ CATCH(e) {
+ switch (e.category) {
+ case host_error:
+ /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+ simdata->comm = NULL;
+ simdata->compute = NULL;
+ #ifdef HAVE_TRACING
+ TRACE_msg_task_execute_end(task);
+ #endif
+ MSG_RETURN(MSG_HOST_FAILURE);
+ break;
+ case cancel_error:
+ /* action ended, set comm and compute = NULL, the actions is already destroyed in the main function */
+ simdata->comm = NULL;
+ simdata->compute = NULL;
+ #ifdef HAVE_TRACING
+ TRACE_msg_task_execute_end(task);
+ #endif
+ MSG_RETURN(MSG_TASK_CANCELED);
+ break;
+ default:
+ RETHROW;
+ }