From: Arnaud Giersch Date: Thu, 16 Jun 2011 08:34:24 +0000 (+0200) Subject: Cosmetics: handle exception inside exception handler. X-Git-Tag: v3_6_1~12 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/6961ee4e0cb867ed6100e487a584fccc703ada4f Cosmetics: handle exception inside exception handler. --- diff --git a/examples/gras/rpc/rpc.c b/examples/gras/rpc/rpc.c index 90864543ad..f686f20f72 100644 --- a/examples/gras/rpc/rpc.c +++ b/examples/gras/rpc/rpc.c @@ -42,17 +42,17 @@ static void exception_catching(void) } CATCH(e) { gotit = 1; + xbt_assert(e.category == unknown_error, + "Got wrong category: %d (instead of %d)", e.category, + unknown_error); + xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); + xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), + "Got wrong message: %s", e.msg); + xbt_ex_free(e); } if (!gotit) { THROWF(unknown_error, 0, "Didn't got the remote exception!"); } - xbt_assert(e.category == unknown_error, - "Got wrong category: %d (instead of %d)", e.category, - unknown_error); - xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); - xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), - "Got wrong message: %s", e.msg); - xbt_ex_free(e); } } @@ -181,19 +181,19 @@ int client(int argc, char *argv[]) } CATCH(e) { gotit = 1; + xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); + xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), + "Got wrong message: %s", e.msg); + xbt_assert(e.category == unknown_error, + "Got wrong category: %d (instead of %d)", + e.category, unknown_error); + XBT_INFO + ("Got the expected exception when calling the exception raising RPC"); + xbt_ex_free(e); } if (!gotit) { THROWF(unknown_error, 0, "Didn't got the remote exception!"); } - xbt_assert(e.value == 42, "Got wrong value: %d (!=42)", e.value); - xbt_assert(!strncmp(e.msg, exception_msg, strlen(exception_msg)), - "Got wrong message: %s", e.msg); - xbt_assert(e.category == unknown_error, - "Got wrong category: %d (instead of %d)", - e.category, unknown_error); - XBT_INFO - ("Got the expected exception when calling the exception raising RPC"); - xbt_ex_free(e); exception_catching(); }