Skip to content

How to get detailed error description? #63

@audi0615

Description

@audi0615

Hi,

Thanks for this great library.

I'm trying to get a detailed error description when an error occurs.

For testing purposes, I used an incorrect bot token and attempted to receive new messages as shown below:

int count = 0;
telebot_error_e ret;
telebot_message_t message;
telebot_update_type_e update_types[] = { TELEBOT_UPDATE_TYPE_MESSAGE };
telebot_update_t* updates;

ret = telebot_get_updates(handle, _offset, 100, 0, update_types, 0, &updates, &count);

The returned value is TELEBOT_ERROR_OPERATION_FAILED, but I need more detailed information, like what is printed in my debugging console:

[ERROR][telebot_core_curl_perform:145] HTTP error: 401 - "Unauthorized"

Is there any function to get error descriptions, such as telebot_get_error_description?

One more thing: currently, telebot_get_updates returns TELEBOT_ERROR_OPERATION_FAILED when there are no new messages. However, this makes it impossible to determine whether there are simply no messages or if an actual error has occurred.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions