gnunet-android

GNUnet for Android
Log | Files | Refs | README

gnunet_error_codes.h (5662B)


      1 /*
      2      This file is part of GNUnet
      3      Copyright (C) 2012-2022 GNUnet e.V.
      4 
      5      GNUnet is free software: you can redistribute it and/or modify it
      6      under the terms of the GNU Affero General Public License as published
      7      by the Free Software Foundation, either version 3 of the License,
      8      or (at your option) any later version.
      9 
     10      GNUnet is distributed in the hope that it will be useful, but
     11      WITHOUT ANY WARRANTY; without even the implied warranty of
     12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13      Affero General Public License for more details.
     14 
     15      You should have received a copy of the GNU Affero General Public License
     16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 
     18      SPDX-License-Identifier: AGPL3.0-or-later
     19  */
     20  /**
     21   * @file include/taler_error_codes.h
     22   * @brief GNUnet error codes, generated via https://gana.gnunet.org/
     23   *
     24   * Do NOT edit this file, it is generated!
     25   */
     26 #ifndef GNUNET_ERROR_CODES_H
     27 #define GNUNET_ERROR_CODES_H
     28 
     29 #ifdef __cplusplus
     30 extern "C" {
     31 #if 0 /* keep Emacsens' auto-indent happy */
     32 }
     33 #endif
     34 #endif
     35 
     36 #include <limits.h>
     37 
     38 
     39 /**
     40  * Taler error codes.
     41  */
     42 enum GNUNET_ErrorCode
     43 {
     44 
     45 
     46   /**
     47    * No error (success).
     48    * Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).
     49    */
     50   GNUNET_EC_NONE = 0,
     51 
     52 
     53   /**
     54    * Unknown and unspecified error.
     55    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
     56    */
     57   GNUNET_EC_UNKNOWN = 1,
     58 
     59 
     60   /**
     61    * Communication with service failed.
     62    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
     63    */
     64   GNUNET_EC_SERVICE_COMMUNICATION_FAILED = 101,
     65 
     66 
     67   /**
     68    * Ego not found.
     69    * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
     70    */
     71   GNUNET_EC_IDENTITY_NOT_FOUND = 200,
     72 
     73 
     74   /**
     75    * Identifier already in use for another ego.
     76    * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
     77    */
     78   GNUNET_EC_IDENTITY_NAME_CONFLICT = 201,
     79 
     80 
     81   /**
     82    * The given ego is invalid or malformed.
     83    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
     84    */
     85   GNUNET_EC_IDENTITY_INVALID = 202,
     86 
     87 
     88   /**
     89    * Unknown namestore error.
     90    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
     91    */
     92   GNUNET_EC_NAMESTORE_UNKNOWN = 5000,
     93 
     94 
     95   /**
     96    * Zone iteration failed.
     97    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
     98    */
     99   GNUNET_EC_NAMESTORE_ITERATION_FAILED = 5001,
    100 
    101 
    102   /**
    103    * Zone not found.
    104    * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
    105    */
    106   GNUNET_EC_NAMESTORE_ZONE_NOT_FOUND = 5002,
    107 
    108 
    109   /**
    110    * Record not found.
    111    * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
    112    */
    113   GNUNET_EC_NAMESTORE_RECORD_NOT_FOUND = 5003,
    114 
    115 
    116   /**
    117    * Zone iteration failed.
    118    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
    119    */
    120   GNUNET_EC_NAMESTORE_RECORD_DELETE_FAILED = 5004,
    121 
    122 
    123   /**
    124    * Zone does not contain any records.
    125    * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
    126    */
    127   GNUNET_EC_NAMESTORE_ZONE_EMPTY = 5005,
    128 
    129 
    130   /**
    131    * Failed to lookup record.
    132    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
    133    */
    134   GNUNET_EC_NAMESTORE_LOOKUP_ERROR = 5006,
    135 
    136 
    137   /**
    138    * No records given.
    139    * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).
    140    */
    141   GNUNET_EC_NAMESTORE_NO_RECORDS_GIVEN = 5007,
    142 
    143 
    144   /**
    145    * Record data invalid.
    146    * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).
    147    */
    148   GNUNET_EC_NAMESTORE_RECORD_DATA_INVALID = 5008,
    149 
    150 
    151   /**
    152    * No label given.
    153    * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).
    154    */
    155   GNUNET_EC_NAMESTORE_NO_LABEL_GIVEN = 5009,
    156 
    157 
    158   /**
    159    * No results given.
    160    * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
    161    */
    162   GNUNET_EC_NAMESTORE_NO_RESULTS = 5010,
    163 
    164 
    165   /**
    166    * Record already exists.
    167    * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
    168    */
    169   GNUNET_EC_NAMESTORE_RECORD_EXISTS = 5011,
    170 
    171 
    172   /**
    173    * Record size exceeds maximum limit.
    174    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
    175    */
    176   GNUNET_EC_NAMESTORE_RECORD_TOO_BIG = 5012,
    177 
    178 
    179   /**
    180    * There was an error in the database backend.
    181    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
    182    */
    183   GNUNET_EC_NAMESTORE_BACKEND_FAILED = 5013,
    184 
    185 
    186   /**
    187    * Failed to store the given records.
    188    * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
    189    */
    190   GNUNET_EC_NAMESTORE_STORE_FAILED = 5014,
    191 
    192 
    193   /**
    194    * Label invalid or malformed.
    195    * Returned with an HTTP status code of #MHD_HTTP_BAD_REQUEST (400).
    196    */
    197   GNUNET_EC_NAMESTORE_LABEL_INVALID = 5015,
    198 
    199 
    200 };
    201 
    202 
    203 /**
    204  * Returns a hint for a given error code.
    205  *
    206  * @param ec the error code.
    207  * @return the hint if it could be found, otherwise "<no hint found>"
    208  */
    209 const char *
    210 GNUNET_ErrorCode_get_hint (enum GNUNET_ErrorCode ec);
    211 
    212 
    213 /**
    214  * Return HTTP status for a given error code.
    215  *
    216  * @param ec the error code.
    217  * @return the HTTP status code for the given @a ec, UINT_MAX if not found
    218  */
    219 unsigned int
    220 GNUNET_ErrorCode_get_http_status (enum GNUNET_ErrorCode ec);
    221 
    222 
    223 /**
    224  * Return HTTP status for a given error code that is guaranteed
    225  * to work (no corner cases).
    226  *
    227  * @param ec the error code.
    228  * @return the HTTP status code for the given @a ec, 500 if
    229  *         the @a ec is not found or is a client-side code
    230  */
    231 unsigned int
    232 GNUNET_ErrorCode_get_http_status_safe (enum GNUNET_ErrorCode ec);
    233 
    234 
    235 #if 0 /* keep Emacsens' auto-indent happy */
    236 {
    237 #endif
    238 #ifdef __cplusplus
    239 }
    240 #endif
    241 
    242 #endif