]> git.sesse.net Git - vlc/blob - src/misc/error.c
e3ab155524872119c7f7df1f5daa0432f9ed2906
[vlc] / src / misc / error.c
1 /*****************************************************************************
2  * error.c: error handling routine
3  *****************************************************************************
4  * Copyright (C) 2002-2004 VideoLAN (Centrale Réseaux) and its contributors
5  * $Id$
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <vlc/vlc.h>
28
29 /*****************************************************************************
30  * vlc_error: strerror() equivalent
31  *****************************************************************************
32  * This function returns a string describing the error code passed in the
33  * argument. A list of all errors can be found in include/vlc/vlc.h.
34  *****************************************************************************/
35 char const * vlc_error ( int i_err )
36 {
37     switch( i_err )
38     {
39         case VLC_SUCCESS:
40             return "no error";
41
42         case VLC_ENOMEM:
43             return "not enough memory";
44         case VLC_ETHREAD:
45             return "thread error";
46         case VLC_ETIMEOUT:
47             return "timeout";
48
49         case VLC_ENOMOD:
50             return "module not found";
51
52         case VLC_ENOOBJ:
53             return "object not found";
54         case VLC_EBADOBJ:
55             return "bad object type";
56
57         case VLC_ENOVAR:
58             return "variable not found";
59         case VLC_EBADVAR:
60             return "bad variable value";
61
62         case VLC_EEXIT:
63             return "program exited";
64         case VLC_EGENERIC:
65             return "generic error";
66         default:
67             return "unknown error";
68     }
69 }
70