-#define RETHROW1(msg,a) _XBT_PRE_RETHROW msg,a, _XBT_POST_RETHROW
-/** @brief like THROW2, but adding some details to the message of an existing exception
- * @hideinitializer
- */
-#define RETHROW2(msg,a,b) _XBT_PRE_RETHROW msg,a,b, _XBT_POST_RETHROW
-/** @brief like THROW3, but adding some details to the message of an existing exception
- * @hideinitializer
- */
-#define RETHROW3(msg,a,b,c) _XBT_PRE_RETHROW msg,a,b,c, _XBT_POST_RETHROW
-/** @brief like THROW4, but adding some details to the message of an existing exception
- * @hideinitializer
- */
-#define RETHROW4(msg,a,b,c,d) _XBT_PRE_RETHROW msg,a,b,c,d, _XBT_POST_RETHROW
-/** @brief like THROW5, but adding some details to the message of an existing exception
- * @hideinitializer
- */
-#define RETHROW5(msg,a,b,c,d,e) _XBT_PRE_RETHROW msg,a,b,c,d,e, _XBT_POST_RETHROW
+#define RETHROWF(...) \
+ do { \
+ char *_xbt_ex_internal_msg = __xbt_running_ctx_fetch()->exception.msg; \
+ __xbt_running_ctx_fetch()->exception.msg = bprintf(__VA_ARGS__, \
+ _xbt_ex_internal_msg); \
+ free(_xbt_ex_internal_msg); \
+ RETHROW; \
+ } while (0)