Skip to content

Commit 4fac768

Browse files
committed
feat: turnkey
1 parent 4790f7a commit 4fac768

File tree

7 files changed

+487
-67
lines changed

7 files changed

+487
-67
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Changelog
22
All notable changes to this project will be documented in this file.
33

4+
## [0.3.2] - 2025-09-08
5+
### Added
6+
- New feature flag `turnkey`:
7+
- Provides `TurnkeyErrorKind` (stable taxonomy of Turnkey-specific failures).
8+
- Provides `TurnkeyError` (kind + public message).
9+
- Adds `classify_turnkey_error` helper for mapping raw SDK/provider messages.
10+
- Includes conversions into `AppError` / `AppErrorKind`.
11+
12+
### Notes
13+
- Feature is framework-agnostic; no extra dependencies are pulled.
14+
415
## [0.3.1] - 2025-08-25
516
### Added
617
- Implemented `axum::response::IntoResponse` for `AppError` (behind the `axum` feature).
@@ -50,6 +61,7 @@ All notable changes to this project will be documented in this file.
5061
- **MSRV:** 1.89
5162
- **No unsafe:** the crate forbids `unsafe`.
5263

64+
[0.3.2]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.2
5365
[0.3.1]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.1
5466
[0.3.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.0
5567
[0.2.1]: https://github.com/RAprogramm/masterror/releases/tag/v0.2.1

Cargo.lock

Lines changed: 52 additions & 61 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "masterror"
3-
version = "0.3.1"
3+
version = "0.3.2"
44
rust-version = "1.89"
55
edition = "2024"
66
description = "Application error types and response mapping"
@@ -24,6 +24,7 @@ config = ["dep:config"] # config::ConfigError -> AppError
2424
multipart = ["axum"]
2525
tokio = ["dep:tokio"]
2626
reqwest = ["dep:reqwest"]
27+
turnkey = []
2728

2829
openapi = ["dep:utoipa"]
2930

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ utoipa = "5"
172172
- `openapi` — utoipa schema
173173
- `serde_json` — JSON details
174174
- `sqlx`, `redis`, `reqwest`, `validator`, `config`, `tokio`, `multipart`
175+
- `turnkey` — domain taxonomy and conversions for Turnkey errors
175176

176177
</details>
177178

@@ -218,6 +219,26 @@ masterror = { version = "0.3", features = [
218219

219220
</details>
220221

222+
<details>
223+
<summary><b>Turnkey</b></summary>
224+
225+
~~~rust
226+
// features = ["turnkey"]
227+
use masterror::turnkey::{classify_turnkey_error, TurnkeyError, TurnkeyErrorKind};
228+
use masterror::{AppError, AppErrorKind};
229+
230+
// Classify a raw SDK/provider error
231+
let kind = classify_turnkey_error("429 Too Many Requests");
232+
assert!(matches!(kind, TurnkeyErrorKind::RateLimited));
233+
234+
// Wrap into AppError
235+
let e = TurnkeyError::new(TurnkeyErrorKind::RateLimited, "throttled upstream");
236+
let app: AppError = e.into();
237+
assert_eq!(app.kind, AppErrorKind::RateLimited);
238+
~~~
239+
240+
</details>
241+
221242
<details>
222243
<summary><b>Migration 0.2 → 0.3</b></summary>
223244

0 commit comments

Comments
 (0)