File: cddb_error.c

package info (click to toggle)
libcddb 1.3.2-6
  • links: PTS
  • area: main
  • in suites: bullseye, buster
  • size: 2,276 kB
  • sloc: sh: 10,946; ansic: 4,721; makefile: 44
file content (96 lines) | stat: -rw-r--r-- 2,674 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/*
    $Id: cddb_error.c,v 1.12 2005/05/29 08:19:09 airborne Exp $

    Copyright (C) 2003, 2004, 2005 Kris Verbeeck <airborne@advalvas.be>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA  02111-1307, USA.
*/

#include "cddb/cddb_ni.h"


static const char* err_str[CDDB_ERR_LAST] = {
    /* CDDB_ERR_OK */
    "ok",

    /* CDDB_ERR_OUT_OF_MEMORY */
    "out of memory",
    /* CDDB_ERR_LINE_SIZE */
    "internal buffer too small",
    /* CDDB_ERR_NOT_IMPLEMENTED */
    "feature not implemented",
    /* CDDB_ERR_UNKNOWN */
    "problem unknown",

    /* CDDB_ERR_SERVER_ERROR */
    "server error",
    /* CDDB_ERR_UNKNOWN_HOST_NAME */
    "unknown host name",
    /* CDDB_ERR_CONNECT */
    "connection error",
    /* CDDB_ERR_PERMISSION_DENIED */
    "permission denied",
    /* CDDB_ERR_NOT_CONNECTED */
    "not connected",

    /* CDDB_ERR_UNEXPECTED_EOF */
    "unexpected end-of-file",
    /* CDDB_ERR_INVALID_RESPONSE */
    "invalid response data",
    /* CDDB_ERR_DISC_NOT_FOUND */
    "disc not found",

    /* CDDN_ERR_DATA_MISSING */
    "command data missing",
    /* CDDB_ERR_TRACK_NOT_FOUND */
    "track not found",
    /* CDDB_ERR_REJECTED */
    "posted data rejected",
    
    /* CDDB_ERR_EMAIL_INVALID */
    "submit e-mail address invalid",

    /* CDDB_ERR_INVALID_CHARSET */
    "invalid character set or unsupported conversion",
    /* CDDB_ERR_ICONV_FAIL */
    "character set conversion failed",

    /* CDDB_ERR_PROXY_AUTH */
    "proxy authentication failed",
    /* CDDB_ERR_INVALID */
    "invalid input parameter"

    /** CDDB_ERR_LAST */
};

const char *cddb_error_str(cddb_error_t errnum)
{
    if ((errnum < 0) || (errnum >= CDDB_ERR_LAST)) {
        return NULL;
    } else {
        return  err_str[errnum];
    }
}

void cddb_error_stream_print(FILE *stream, cddb_error_t errnum)
{
    fprintf(stream, "libcddb: error: %s\n", cddb_error_str(errnum));
}

void cddb_error_print(cddb_error_t errnum)
{
    cddb_error_stream_print(stderr, errnum);
}