Skip to content

feat: add TelegramEx.Error struct for API errors#23

Merged
lsdrfrx merged 1 commit into
lsdrfrx:developfrom
SAY-5:feat/error-struct
Jun 27, 2026
Merged

feat: add TelegramEx.Error struct for API errors#23
lsdrfrx merged 1 commit into
lsdrfrx:developfrom
SAY-5:feat/error-struct

Conversation

@SAY-5

@SAY-5 SAY-5 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a TelegramEx.Error struct so API errors surface their code, description, and retry hint instead of collapsing to a single :bad_request atom. TelegramEx.API now returns {:error, %TelegramEx.Error{}} from both error-handling paths (get_updates/2 and the shared handle_response/1), parsing error_code, description, and parameters.retry_after from the response body and keeping the raw payload around. This makes it possible to, for example, read retry_after on a 429 and back off appropriately.

Ready Checklist

  • Implementation: code works, types are specified, dialyzer passes
  • Documentation: functions have @doc, README updated if needed
  • Tests: tests added/updated, mix test passes locally
  • Example: usage example added to /example

Related Issues

Closes #19

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
@lsdrfrx
lsdrfrx changed the base branch from main to develop June 27, 2026 08:59
@lsdrfrx
lsdrfrx merged commit 8979215 into lsdrfrx:develop Jun 27, 2026
1 check passed
@lsdrfrx

lsdrfrx commented Jun 27, 2026

Copy link
Copy Markdown
Owner

Thanks for your contribution! Truly appreciated. 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add TelegramEx.Error struct

2 participants