Skip to content

How to get original error from api? #221

Answered by mymmrac
meoww-bot asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can get original error message, Telego has type for that, please see example:

_, err := bot.EditMessageText(...)
if err != nil {
    var apiErr *ta.Error
    if errors.As(err, &apiErr) {
        fmt.Println(apiErr.Description, apiErr.ErrorCode)
    }
    return err
}

Note: ta.Error is github.com/mymmrac/telego/telegoapi.Error

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@meoww-bot
Comment options

Answer selected by mymmrac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants