22#include <microhttpd.h>
28#define MHD_HTTP_UNINITIALIZED 0
66 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
71 .hint =
gettext_noop (
"Communication with service failed."),
72 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
78 .http_code = MHD_HTTP_NOT_FOUND
83 .hint =
gettext_noop (
"Identifier already in use for another ego."),
84 .http_code = MHD_HTTP_CONFLICT
89 .hint =
gettext_noop (
"The given ego is invalid or malformed."),
90 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
96 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
102 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
108 .http_code = MHD_HTTP_NOT_FOUND
114 .http_code = MHD_HTTP_NOT_FOUND
120 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
125 .hint =
gettext_noop (
"Zone does not contain any records."),
126 .http_code = MHD_HTTP_NOT_FOUND
132 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
138 .http_code = MHD_HTTP_BAD_REQUEST
144 .http_code = MHD_HTTP_BAD_REQUEST
150 .http_code = MHD_HTTP_BAD_REQUEST
156 .http_code = MHD_HTTP_NOT_FOUND
162 .http_code = MHD_HTTP_CONFLICT
167 .hint =
gettext_noop (
"Record size exceeds maximum limit."),
168 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
173 .hint =
gettext_noop (
"There was an error in the database backend."),
174 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
179 .hint =
gettext_noop (
"Failed to store the given records."),
180 .http_code = MHD_HTTP_INTERNAL_SERVER_ERROR
186 .http_code = MHD_HTTP_BAD_REQUEST
203 unsigned int lower = 0;
205 unsigned int mid = upper / 2;
206 while (lower <= upper)
208 mid = (upper + lower) / 2;
222 return "<no hint found>";
229 unsigned int lower = 0;
231 unsigned int mid = upper / 2;
232 while (lower <= upper)
234 mid = (upper + lower) / 2;
260 return MHD_HTTP_INTERNAL_SERVER_ERROR;
#define gettext_noop(String)
unsigned int GNUNET_ErrorCode_get_http_status_safe(enum GNUNET_ErrorCode ec)
Return HTTP status for a given error code that is guaranteed to work (no corner cases).
static const unsigned int code_hint_pairs_length
The length of code_hint_pairs.
#define MHD_HTTP_UNINITIALIZED
MHD does not define our value for 0 (client-side generated code).
const char * GNUNET_ErrorCode_get_hint(enum GNUNET_ErrorCode ec)
Returns a hint for a given error code.
unsigned int GNUNET_ErrorCode_get_http_status(enum GNUNET_ErrorCode ec)
Return HTTP status for a given error code.
static const struct ErrorCodeAndHint code_hint_pairs[]
The list of all error codes with their hints.
GNUNET_ErrorCode
Taler error codes.
@ GNUNET_EC_NAMESTORE_NO_RESULTS
No results given.
@ GNUNET_EC_NAMESTORE_RECORD_DELETE_FAILED
Zone iteration failed.
@ GNUNET_EC_NAMESTORE_LABEL_INVALID
Label invalid or malformed.
@ GNUNET_EC_NAMESTORE_LOOKUP_ERROR
Failed to lookup record.
@ GNUNET_EC_IDENTITY_INVALID
The given ego is invalid or malformed.
@ GNUNET_EC_NAMESTORE_BACKEND_FAILED
There was an error in the database backend.
@ GNUNET_EC_NAMESTORE_ITERATION_FAILED
Zone iteration failed.
@ GNUNET_EC_NAMESTORE_ZONE_EMPTY
Zone does not contain any records.
@ GNUNET_EC_NAMESTORE_RECORD_TOO_BIG
Record size exceeds maximum limit.
@ GNUNET_EC_SERVICE_COMMUNICATION_FAILED
Communication with service failed.
@ GNUNET_EC_NAMESTORE_STORE_FAILED
Failed to store the given records.
@ GNUNET_EC_NAMESTORE_NO_LABEL_GIVEN
No label given.
@ GNUNET_EC_NAMESTORE_RECORD_DATA_INVALID
Record data invalid.
@ GNUNET_EC_NAMESTORE_NO_RECORDS_GIVEN
No records given.
@ GNUNET_EC_UNKNOWN
Unknown and unspecified error.
@ GNUNET_EC_NAMESTORE_ZONE_NOT_FOUND
Zone not found.
@ GNUNET_EC_NONE
No error (success).
@ GNUNET_EC_IDENTITY_NOT_FOUND
Ego not found.
@ GNUNET_EC_IDENTITY_NAME_CONFLICT
Identifier already in use for another ego.
@ GNUNET_EC_NAMESTORE_RECORD_EXISTS
Record already exists.
@ GNUNET_EC_NAMESTORE_UNKNOWN
Unknown namestore error.
@ GNUNET_EC_NAMESTORE_RECORD_NOT_FOUND
Record not found.
A pair containing an error code and its hint.
enum GNUNET_ErrorCode ec
The error code.
unsigned int http_code
The HTTP status code.
const char * hint
The hint.