Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Continue doxygenification
[simgrid.git] / src / xbt / error.c
1 /* $Id$ */
2
3 /* error - Error handling functions                                         */
4
5 /* Authors: Martin Quinson                                                  */
6 /* Copyright (C) 2001,2002,2003,2004 the OURAGAN project.                   */
7
8 /* This program is free software; you can redistribute it and/or modify it
9    under the terms of the license (GNU LGPL) which comes with this package. */
10
11 #include "xbt/error.h"
12 /** \defgroup  XBT_error Error tracking support.
13  *  \brief This section describes a set of macros used to handle errors easily.
14  */
15
16 /**
17  * \brief Usefull to do nice error repporting messages.
18  * \ingroup XBT_error
19  * \param errcode 
20  * \return the printable name of an error code
21  *
22  */
23 const char *xbt_error_name(xbt_error_t errcode)  {
24
25    switch (errcode) {
26       
27     case no_error: return "success";
28     case mismatch_error: return "mismatch";
29     case system_error: return "system";
30     case network_error: return "network";
31     case timeout_error: return "timeout";
32     case thread_error: return "thread";
33     case unknown_error: return "unclassified";
34     default:
35       return "SEVERE ERROR in error repporting module";
36    }
37 }
38
39 XBT_LOG_EXTERNAL_CATEGORY(xbt);
40 XBT_LOG_DEFAULT_CATEGORY(xbt);
41   
42 /**
43  * \ingroup XBT_error
44  * \param msg 
45  *
46  * Things are so messed up that the only thing to do now, is to stop the program.
47  */
48 void xbt_die (const char *msg) {
49    CRITICAL1("%s",msg);
50    xbt_abort();
51 }
52