- lua_pop(L, 1);
- /* task */
- }
- else {
- switch (res) {
- case MSG_TIMEOUT:
- XBT_DEBUG("MSG_task_send failed : Timeout");
- break;
- case MSG_TRANSFER_FAILURE:
- XBT_DEBUG("MSG_task_send failed : Transfer Failure");
- break;
- case MSG_HOST_FAILURE:
- XBT_DEBUG("MSG_task_send failed : Host Failure ");
- break;
- default:
- XBT_ERROR
- ("MSG_task_send failed : Unexpected error , please report this bug");
- break;
- }
+ return 0;
+
+ case MSG_TIMEOUT:
+ XBT_DEBUG("MSG_task_send failed: timeout");
+ lua_settop(L, 0);
+ lua_pushliteral(L, "timeout");
+ return 1;
+
+ case MSG_TRANSFER_FAILURE:
+ XBT_DEBUG("MSG_task_send failed: transfer failure");
+ lua_settop(L, 0);
+ lua_pushliteral(L, "transfer failure");
+ return 1;
+
+ case MSG_HOST_FAILURE:
+ XBT_DEBUG("MSG_task_send failed: host failure");
+ lua_settop(L, 0);
+ lua_pushliteral(L, "host failure");
+ return 1;
+
+ default:
+ xbt_die("Unexpected result of MSG_task_send: %d, please report this bug", res);