You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(error): add AppError + anyhow, make startup fail cleanly (#603)
Introduces the error-handling foundation (RECOMMENDATIONS.md §1):
- new `src/error.rs` with a `thiserror`-based `AppError` enum
(Redis/Postgres/Telegram/Http/Gpt/BadInput), exported from the crate
root for use by handler boundaries in a later iteration.
- add `thiserror` + `anyhow` dependencies.
- `main()` and `run()` now return `anyhow::Result<()>`, and
`establish_connection()` returns `anyhow::Result<PgPool>`. Every
startup fallible step — Telegram token, Postgres/Redis connect, the
three env reads — propagates with `?` + `.context(...)` instead of
`unwrap()`/`expect()`.
- replace `Bot::from_env()` (panics on missing token) with an explicit
`TELOXIDE_TOKEN` read so all boot config fails uniformly.
Boot with missing config now prints a contextual error and exits 1
instead of panicking. No behavior change on the happy path.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments