Coverage Report

Created: 2025-12-31 07:08

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wget2/libwget/error.c
Line
Count
Source
1
/*
2
 * Copyright (c) 2018-2024 Free Software Foundation, Inc.
3
 *
4
 * This file is part of libwget.
5
 *
6
 * Libwget is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU Lesser General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * Libwget is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU Lesser General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU Lesser General Public License
17
 * along with libwget.  If not, see <https://www.gnu.org/licenses/>.
18
 */
19
20
#include <config.h>
21
22
#include <wget.h>
23
#include "private.h"
24
25
/**
26
 * \file
27
 * \brief Error functions
28
 * \defgroup libwget-error Error functions
29
 * @{
30
 *
31
 * Here are th implementations of libwget error functions.
32
 */
33
34
/**
35
 * \param[in] rc Error code from another libwget function
36
 * \return A humanly readable string describing error
37
 *
38
 * Convert an internal libwget error code to a humanly readable string.
39
 * The returned pointer must not be de-allocated by the caller.
40
 */
41
const char *wget_strerror(wget_error err)
42
0
{
43
0
  switch (err) {
44
0
  case WGET_E_SUCCESS: return _("Success");
45
0
  case WGET_E_UNKNOWN: return _("General error");
46
0
  case WGET_E_MEMORY: return _("No memory");
47
0
  case WGET_E_INVALID: return _("Invalid value");
48
0
  case WGET_E_TIMEOUT: return _("Timeout");
49
0
  case WGET_E_CONNECT: return _("Connect error");
50
0
  case WGET_E_HANDSHAKE: return _("Handshake error");
51
0
  case WGET_E_CERTIFICATE: return _("Certificate error");
52
0
  case WGET_E_TLS_DISABLED: return _("libwget has been built without TLS support");
53
0
  case WGET_E_XML_PARSE_ERR: return _("Failed to parse XML");
54
0
  case WGET_E_OPEN: return _("Failed to open file");
55
0
  case WGET_E_IO: return _("I/O error");
56
0
  case WGET_E_UNSUPPORTED: return _("Unsupported function");
57
0
  default: return _("Unknown error");
58
0
  }
59
0
}
60
61
/**@}*/