Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill old $Id$ command dating from CVS
[simgrid.git] / src / xbt / error.c
1 /* error - Error handling functions                                         */
2
3 /* Authors: Martin Quinson                                                  */
4 /* Copyright (C) 2001,2002,2003,2004 the OURAGAN project.                   */
5
6 /* This program is free software; you can redistribute it and/or modify it
7    under the terms of the license (GNU LGPL) which comes with this package. */
8
9 #include "xbt/sysdep.h"
10
11 /**
12  * \brief Usefull to do nice error repporting messages.
13  *
14  * \param errcode
15  * \return the printable name of an error code
16  *
17  */
18 const char *xbt_error_name(xbt_error_t errcode)  {
19
20   switch (errcode) {
21
22     case no_error: return "success";
23     case old_mismatch_error: return "mismatch";
24     case old_system_error: return "system";
25     case old_network_error: return "network";
26     case old_timeout_error: return "timeout";
27     case old_thread_error: return "thread";
28     case old_unknown_error: return "unclassified";
29     default:
30       return "SEVERE ERROR in error repporting module";
31   }
32 }
33
34 XBT_LOG_EXTERNAL_CATEGORY(xbt);
35 XBT_LOG_DEFAULT_CATEGORY(xbt);
36
37 /**
38  * @brief Kill the program with an error message
39  * \param msg
40  *
41  * Things are so messed up that the only thing to do now, is to stop the program.
42  *
43  * The message is handled by a CRITICAL logging request
44  *
45  * If you want to pass arguments to the format, you can always write xbt_assert1(0,"fmt",args)
46  */
47 void xbt_die (const char *msg) {
48   CRITICAL1("%s",msg);
49   xbt_abort();
50 }
51
52 /** @brief Kill the program in silence */
53 void xbt_abort(void) {
54   abort();
55 }