Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.3.4] - 2025-09-12
### Added
- `ErrorResponse::with_retry_after_duration` helper for specifying retry advice via `Duration`.
- Conversion from `telegram_webapp_sdk::utils::validate_init_data::ValidationError` into `AppError` (feature `telegram-webapp-sdk`).
Expand All @@ -19,6 +21,7 @@ All notable changes to this project will be documented in this file.
- Added Axum test asserting `MultipartError` becomes `AppErrorKind::BadRequest` and preserves the message.
- Expanded Actix test to check JSON body and `Retry-After`/`WWW-Authenticate` headers.
- Covered fallback classification of unknown messages as `TurnkeyErrorKind::Service`.
- Expanded coverage of `telegram_webapp_sdk` mapping across all `ValidationError` variants.

## [0.3.3] - 2025-09-11
### Added
Expand Down Expand Up @@ -96,6 +99,7 @@ All notable changes to this project will be documented in this file.
- **MSRV:** 1.89
- **No unsafe:** the crate forbids `unsafe`.

[0.3.4]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.4
[0.3.3]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.3
[0.3.2]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.2
[0.3.1]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.1
Expand Down
14 changes: 13 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "masterror"
version = "0.3.3"
version = "0.3.4"
rust-version = "1.89"
edition = "2024"
description = "Application error types and response mapping"
Expand Down
20 changes: 20 additions & 0 deletions src/convert/telegram_webapp_sdk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
//!
//! ## Example
//!
//! ```rust
//! # #[cfg(feature = "telegram-webapp-sdk")]
//! # {
//! ```rust,ignore
//! use masterror::{AppError, AppErrorKind};
//! use telegram_webapp_sdk::utils::validate_init_data::ValidationError;
Expand All @@ -28,6 +31,8 @@
//!
//! let e = convert(ValidationError::SignatureMismatch);
//! assert!(matches!(e.kind, AppErrorKind::TelegramAuth));
//! assert_eq!(e.message.as_deref(), Some("signature mismatch"));
//! # }
//! ```

#[cfg(feature = "telegram-webapp-sdk")]
Expand All @@ -53,6 +58,21 @@ mod tests {
use crate::AppErrorKind;

#[test]
fn all_variants_map_to_telegram_auth_and_preserve_message() {
let cases = vec![
ValidationError::MissingField("hash"),
ValidationError::InvalidEncoding,
ValidationError::InvalidSignatureEncoding,
ValidationError::SignatureMismatch,
ValidationError::InvalidPublicKey,
];

for case in cases {
let msg = case.to_string();
let app: AppError = case.into();
assert!(matches!(app.kind, AppErrorKind::TelegramAuth));
assert_eq!(app.message.as_deref(), Some(msg.as_str()));
}
fn validation_error_maps_to_telegram_auth() {
let err: AppError = ValidationError::SignatureMismatch.into();
assert!(matches!(err.kind, AppErrorKind::TelegramAuth));
Expand Down
Loading