Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
improve peer creator: use sg_platf_new_*, not the XML bypassing mechanism
[simgrid.git] / doc / gtut-tour-08-exceptions.doc
index 5f646cf..057e9bf 100644 (file)
@@ -44,23 +44,24 @@ information about the host on which they were thrown (#xbt_ex_t) along with
 the thrown point in the source code.
 
 The syntax of XBT exceptions should not sound unfamilliar to most of you.
 the thrown point in the source code.
 
 The syntax of XBT exceptions should not sound unfamilliar to most of you.
-You throw them using the #THROW0...#THROW7 macros. They take 2 extra
-arguments in addition to the format and its self arguments: an error
-category (of type #xbt_errcat_t) and an error "value" (an integer;
-pratically, this is often left to 0 in my own code). So, you may have
-something like the following:
-\verbatim THROW3(system_error, 0, "Cannot connect to %s:%d because of %s", hostname, port, reason);\endverbatim
+You throw them using the #THROW and #THROWF macros. They take 2 arguments:
+an error category (of type #xbt_errcat_t) and an error "value" (an integer;
+pratically, this is often left to 0 in my own code). #THROWF also takes a
+message string as extra argument which is a printf-like format string with
+its own arguments. So, you may have something like the following:
+\verbatim THROWF(system_error, 0, "Cannot connect to %s:%d because of %s", hostname, port, reason);\endverbatim
 
 Then, you simply add a #TRY/#CATCH block around your code:
 \verbatim TRY{ 
   /* your code */ 
 
 Then, you simply add a #TRY/#CATCH block around your code:
 \verbatim TRY{ 
   /* your code */ 
-} CATCH(e) { 
+}
+CATCH(e) {
   /* error handling code */
 } \endverbatim
 
 Another strange thing is that you should actually free the memory allocated
 to the exception with xbt_ex_fres() if you manage to deal with them. There
   /* error handling code */
 } \endverbatim
 
 Another strange thing is that you should actually free the memory allocated
 to the exception with xbt_ex_fres() if you manage to deal with them. There
-is a bit more than this on the picture (#CLEANUP blocks, for example), and
+is a bit more than this on the picture (#TRY_CLEANUP blocks, for example), and
 you should check the section \ref XBT_ex for more details.
 
 You should be <b>very carfull</b> when using the exceptions. They work great
 you should check the section \ref XBT_ex for more details.
 
 You should be <b>very carfull</b> when using the exceptions. They work great
@@ -146,6 +147,6 @@ The complete program reads:
 \include 08-exceptions.c
 
 
 \include 08-exceptions.c
 
 
-Go to \ref GRAS_tut_tour_rpc
+Go to \ref GRAS_tut_tour_simpledata
 
 */
 
 */