Concord - C Discord API library
A Discord API wrapper library written in C
Error handling

Concord error codes and meaning. More...

Typedefs

typedef enum CCORDcode CCORDcode
 

Enumerations

enum  CCORDcode {
  CCORD_MALFORMED_PAYLOAD = -12 , CCORD_FULL_WORKER = -11 , CCORD_RESOURCE_UNAVAILABLE = -10 , CCORD_UNAVAILABLE = CCORD_RESOURCE_UNAVAILABLE ,
  CCORD_RESOURCE_OWNERSHIP = -9 , CCORD_OWNERSHIP = CCORD_RESOURCE_OWNERSHIP , CCORD_GLOBAL_INIT = -8 , CCORD_CURLM_INTERNAL = -7 ,
  CCORD_CURLE_INTERNAL = -6 , CCORD_BAD_JSON = -5 , CCORD_BAD_PARAMETER = -4 , CCORD_UNUSUAL_HTTP_CODE = -3 ,
  CCORD_CURL_NO_RESPONSE = -2 , CCORD_HTTP_CODE = -1 , CCORD_OK = 0 , CCORD_PENDING ,
  CCORD_DISCORD_JSON_CODE = 100 , CCORD_DISCORD_BAD_AUTH , CCORD_DISCORD_RATELIMIT , CCORD_DISCORD_CONNECTION
}
 

Functions

CCORDcode discord_return_error (struct discord *client, const char error[], CCORDcode code)
 Return a Concord's error. More...
 
const char * discord_strerror (CCORDcode code, struct discord *client)
 Return the meaning of CCORDcode. More...
 

Detailed Description

Concord error codes and meaning.

Typedef Documentation

◆ CCORDcode

typedef enum CCORDcode CCORDcode

Enumeration Type Documentation

◆ CCORDcode

enum CCORDcode
Enumerator
CCORD_MALFORMED_PAYLOAD 

failure when creating request's payload

CCORD_FULL_WORKER 

couldn't enqueue worker thread (queue is full)

CCORD_RESOURCE_UNAVAILABLE 

couldn't perform action because resource is unavailable

CCORD_UNAVAILABLE 
CCORD_RESOURCE_OWNERSHIP 

couldn't cleanup resource automatically due to being claimed

CCORD_OWNERSHIP 
CCORD_GLOBAL_INIT 

attempt to initialize globals more than once

CCORD_CURLM_INTERNAL 

curl's multi handle internal error

CCORD_CURLE_INTERNAL 

curl's easy handle internal error

CCORD_BAD_JSON 

internal failure when encoding or decoding JSON

CCORD_BAD_PARAMETER 

bad value for parameter

CCORD_UNUSUAL_HTTP_CODE 

received a non-standard http code

CCORD_CURL_NO_RESPONSE 

no response came through from curl

CCORD_HTTP_CODE 

request wasn't succesful

CCORD_OK 

action was a success

CCORD_PENDING 

action is pending (ex: request has been enqueued and will be performed later)

CCORD_DISCORD_JSON_CODE 

received a JSON error message

CCORD_DISCORD_BAD_AUTH 

bad authentication token

CCORD_DISCORD_RATELIMIT 

being ratelimited

CCORD_DISCORD_CONNECTION 

couldn't establish connection to Discord

Function Documentation

◆ discord_return_error()

CCORDcode discord_return_error ( struct discord client,
const char  error[],
CCORDcode  code 
)

Return a Concord's error.

Note
used to log and return an error
Parameters
clientthe client created with discord_init(), NULL for generic error
errorthe error string to be logged
codethe error code
Returns
the error code

◆ discord_strerror()

const char * discord_strerror ( CCORDcode  code,
struct discord client 
)

Return the meaning of CCORDcode.

Parameters
codethe CCORDcode value
client
Note
unused parameter
Returns
a string containing the code meaning
Examples
audit-log.c, channel.c, emoji.c, guild-template.c, guild.c, reaction.c, and slash-commands2.c.