Skip to main content

Error callback

The enum information and error callback method that may occur when using the chat.

Callback method

// The callback method that relays errors that may occur when using the chat.
void OnError(BackndChat::ERROR_MESSAGE error, void* param)
{
string message = BackndChat::ErrorMessageToString(error).c_str();

switch (error)
{
case BackndChat::ERROR_MESSAGE::CHAT_BAN:
{
BackndChat::ErrorMessageChatBanParam chatBanParam = *(BackndChat::ErrorMessageChatBanParam*)param;

std::cout << "banTime: " << chatBanParam.RemainSeconds << std::endl;
}
break;

case BackndChat::ERROR_MESSAGE::CHANNEL_FULL:
case BackndChat::ERROR_MESSAGE::INVALID_PASSWORD:
case BackndChat::ERROR_MESSAGE::ALREADY_CREATED_CHANNEL:
case BackndChat::ERROR_MESSAGE::CHANNEL_GROUP_TOO_SHORT:
case BackndChat::ERROR_MESSAGE::CHANNEL_GROUP_TOO_LONG:
case BackndChat::ERROR_MESSAGE::CHANNEL_NAME_TOO_SHORT:
case BackndChat::ERROR_MESSAGE::CHANNEL_NAME_TOO_LONG:
case BackndChat::ERROR_MESSAGE::DUPLICATE_CHANNEL_GROUP:
case BackndChat::ERROR_MESSAGE::PASSWORD_TOO_LONG:
case BackndChat::ERROR_MESSAGE::CHANNEL_GROUP_FILTERED:
case BackndChat::ERROR_MESSAGE::CHANNEL_NAME_FILTERED:
{
BackndChat::ErrorMessageChannelParam channelParam = *(BackndChat::ErrorMessageChannelParam*)param;

std::cout << "channelGroup: " << channelParam.ChannelGroup << std::endl;
std::cout << "channelName: " << channelParam.ChannelName << std::endl;
std::cout << "channelNumber: " << channelParam.ChannelNumber << std::endl;
}
break;

default:
break;
}
}

ErrorCode(enum)

ValueDescriptionParam
NOT_AUTHENTICATIONThis user is unauthenticated.NULL
CHAT_SERVER_FULLThe chat server is full.NULL
WHISPER_OFFLINEThe recipient of the whisper is offline.NULL
TOO_MANY_REPORTYou exceeded the daily report limit.NULL
NOT_MY_REPORTYou cannot report yourself.NULL
INVALID_PARAMETERYou entered a wrong parameter value.NULL
CHAT_BANYou are currently banned from chat.ErrorMessageChatBanParam
DISABLED_CHANNELChat is not enabled.NULL
MESSAGE_TOO_LONGThe chat message is too long.NULL
MESSAGE_TOO_SHORTThe chat message is too short.NULL
MESSAGE_FILTEREDThe chat message has been filtered.NULL
MESSAGE_SPAMThe chat message has been blocked due to spamming.NULL
NOT_NICKNAMENickname is not set.NULL
DISABLED_SERVICEThe service (whisper, guild chat, etc.) is not enabled.NULL
CHANNEL_FULLThe channel is full.ErrorMessageChannelParam
NOT_JOIN_CHANNELYou are not in this channel.NULL
ALREADY_CREATED_CHANNELThe channel has already been created. (when creating a channel)ErrorMessageChannelParam
DUPLICATE_CHANNEL_GROUPThe channel group already exists. (when creating a channel)ErrorMessageChannelParam
CHANNEL_GROUP_TOO_LONGThe channel group is too short. (when creating a channel)ErrorMessageChannelParam
CHANNEL_GROUP_TOO_SHORTThe channel group is too long. (when creating a channel)ErrorMessageChannelParam
CHANNEL_GROUP_FILTEREDThe channel group has been filtered. (when creating a channel)ErrorMessageChannelParam
DUPLICATE_CHANNEL_NAMEThe channel name already exists. (when creating a channel)NULL
CHANNEL_NAME_TOO_LONGThe channel name is too short. (when creating a channel)ErrorMessageChannelParam
CHANNEL_NAME_TOO_SHORTThe channel name is too long. (when creating a channel)ErrorMessageChannelParam
CHANNEL_NAME_FILTEREDThe channel name has been filtered. (when creating a channel)ErrorMessageChannelParam
PASSWORD_TOO_LONGThe password is too long. (when creating a channel)ErrorMessageChannelParam
INVALID_PASSWORDThe password you entered is invalid. (when entering a channel)ErrorMessageChannelParam
LIMIT_REPORT_MESSAGE_DAYSThis message cannot be reported because it is too old.NULL
ALREADY_JOIN_CHANNELYou are already in this channel. You cannot enter multiple open channels within the same channel group.NULL

Param

struct ErrorMessageChatBanParam
{
// Time left until the chat ban is lifted (sec)
uint64_t RemainSeconds;
};
struct ErrorMessageChannelParam
{
// Channel group
string ChannelGroup;

// Channel name
string ChannelName;

// Channel number
uint64_t ChannelNumber;
};