Skip to content

Commit 1d9198f

Browse files
committed
Publish masterror-template for derive releases
1 parent 13329b7 commit 1d9198f

File tree

8 files changed

+215
-17
lines changed

8 files changed

+215
-17
lines changed

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file.
33

44
## [Unreleased]
55

6+
## [0.10.7] - 2025-10-24
7+
8+
### Fixed
9+
- Published the shared template parser crate so `masterror-derive` no longer
10+
depends on a workspace-only package when uploaded to crates.io.
11+
12+
### Changed
13+
- Bumped `masterror-derive` to `0.6.6` and `masterror-template` to `0.3.6` so
14+
downstream users rely on the newly published parser crate.
15+
16+
### Documentation
17+
- Added a dedicated README for `masterror-template` describing installation,
18+
parsing examples and formatter metadata for crates.io readers.
19+
20+
## [0.10.6] - 2025-09-21
21+
22+
### Fixed
23+
- Added a crate-local README for `masterror-derive` so `cargo publish` passes
24+
when crates.io validates the `readme` manifest key.
25+
26+
### Changed
27+
- Bumped `masterror-derive` to `0.6.2` to capture the packaging fix.
28+
29+
### Documentation
30+
- Documented the derive macros and supported attributes in
31+
`masterror-derive/README.md` for crates.io readers.
32+
633
## [0.10.5] - 2025-09-20
734

835
### Added
@@ -140,6 +167,12 @@ All notable changes to this project will be documented in this file.
140167
- Documented the `#[app_error(...)]` attribute in the README, outlining the
141168
struct and enum mapping patterns and the `message` flag behaviour.
142169

170+
## [0.6.6] - 2025-10-24
171+
172+
### Fixed
173+
- Pointed the derive crate at the published `masterror-template` dependency so
174+
`cargo publish` succeeds without private workspace patches.
175+
143176
## [0.6.5] - 2025-10-12
144177

145178
### Added
@@ -437,6 +470,15 @@ All notable changes to this project will be documented in this file.
437470
### Documentation
438471
- Documented browser/WASM support and console logging workflow in the README and crate docs.
439472

473+
## [0.3.6] - 2025-10-24
474+
475+
### Added
476+
- Wrote a README for crates.io explaining installation and parser usage.
477+
478+
### Fixed
479+
- Removed the `publish = false` flag so the shared template parser can be
480+
released alongside the derive crate.
481+
440482
## [0.3.5] - 2025-09-12
441483
### Added
442484
- Conversion from `teloxide_core::RequestError` into `AppError` (feature `teloxide`).
@@ -537,10 +579,19 @@ All notable changes to this project will be documented in this file.
537579
- **MSRV:** 1.89
538580
- **No unsafe:** the crate forbids `unsafe`.
539581

582+
[0.10.7]: https://github.com/RAprogramm/masterror/releases/tag/v0.10.7
583+
[0.10.6]: https://github.com/RAprogramm/masterror/releases/tag/v0.10.6
584+
[0.6.6]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.6
585+
[0.6.5]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.5
586+
[0.6.4]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.4
587+
[0.6.3]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.3
588+
[0.6.2]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.2
589+
[0.6.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.6.0
540590
[0.5.2]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.2
541591
[0.5.1]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.1
542592
[0.5.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.5.0
543593
[0.4.0]: https://github.com/RAprogramm/masterror/releases/tag/v0.4.0
594+
[0.3.6]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.6
544595
[0.3.5]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.5
545596
[0.3.4]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.4
546597
[0.3.3]: https://github.com/RAprogramm/masterror/releases/tag/v0.3.3

Cargo.lock

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

Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "masterror"
3-
version = "0.10.5"
3+
version = "0.10.7"
44
rust-version = "1.90"
55
edition = "2024"
66
license = "MIT OR Apache-2.0"
@@ -71,8 +71,8 @@ turnkey = []
7171
openapi = ["dep:utoipa"]
7272

7373
[workspace.dependencies]
74-
masterror-derive = { version = "0.6.1" }
75-
masterror-template = { version = "0.3.1" }
74+
masterror-derive = { version = "0.6.6" }
75+
masterror-template = { version = "0.3.6" }
7676

7777
[dependencies]
7878
masterror-derive = { version = "0.6" }

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ Stable categories, conservative HTTP mapping, no `unsafe`.
2929

3030
~~~toml
3131
[dependencies]
32-
masterror = { version = "0.10.5", default-features = false }
32+
masterror = { version = "0.10.7", default-features = false }
3333
# or with features:
34-
# masterror = { version = "0.10.5", features = [
34+
# masterror = { version = "0.10.7", features = [
3535
# "axum", "actix", "openapi", "serde_json",
3636
# "sqlx", "sqlx-migrate", "reqwest", "redis",
3737
# "validator", "config", "tokio", "multipart",
@@ -66,10 +66,10 @@ masterror = { version = "0.10.5", default-features = false }
6666
~~~toml
6767
[dependencies]
6868
# lean core
69-
masterror = { version = "0.10.5", default-features = false }
69+
masterror = { version = "0.10.7", default-features = false }
7070

7171
# with Axum/Actix + JSON + integrations
72-
# masterror = { version = "0.10.5", features = [
72+
# masterror = { version = "0.10.7", features = [
7373
# "axum", "actix", "openapi", "serde_json",
7474
# "sqlx", "sqlx-migrate", "reqwest", "redis",
7575
# "validator", "config", "tokio", "multipart",
@@ -623,13 +623,13 @@ assert_eq!(resp.status, 401);
623623
Minimal core:
624624

625625
~~~toml
626-
masterror = { version = "0.10.5", default-features = false }
626+
masterror = { version = "0.10.7", default-features = false }
627627
~~~
628628

629629
API (Axum + JSON + deps):
630630

631631
~~~toml
632-
masterror = { version = "0.10.5", features = [
632+
masterror = { version = "0.10.7", features = [
633633
"axum", "serde_json", "openapi",
634634
"sqlx", "reqwest", "redis", "validator", "config", "tokio"
635635
] }
@@ -638,7 +638,7 @@ masterror = { version = "0.10.5", features = [
638638
API (Actix + JSON + deps):
639639

640640
~~~toml
641-
masterror = { version = "0.10.5", features = [
641+
masterror = { version = "0.10.7", features = [
642642
"actix", "serde_json", "openapi",
643643
"sqlx", "reqwest", "redis", "validator", "config", "tokio"
644644
] }
@@ -709,4 +709,3 @@ MSRV = 1.90 (may raise in minor, never in patch).
709709
Apache-2.0 OR MIT, at your option.
710710

711711
</details>
712-

masterror-derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "masterror-derive"
33
rust-version = "1.90"
4-
version = "0.6.1"
4+
version = "0.6.6"
55
edition = "2024"
66
license = "MIT OR Apache-2.0"
77
repository = "https://github.com/RAprogramm/masterror"

masterror-derive/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# masterror-derive
2+
3+
Procedural macros that power [`masterror`](https://crates.io/crates/masterror)'s
4+
`#[derive(Error)]`. The derive generates ergonomic `std::error::Error` and
5+
`Display` implementations together with seamless integration into
6+
`masterror`'s domain-centric `AppError` type.
7+
8+
> **Tip:** Depend on the `masterror` crate in application code and import the
9+
> macros from there (`use masterror::Error;`). This standalone crate is
10+
> published to make `cargo install`/`cargo package` flows happy and to support
11+
> advanced macro integrations.
12+
13+
## Quick start
14+
15+
```toml
16+
[dependencies]
17+
masterror = "0.10"
18+
```
19+
20+
```rust
21+
use masterror::{AppError, Error};
22+
23+
#[derive(Error)]
24+
#[error(display = "failed to parse payload: {source}")]
25+
#[app_error(kind = "BadRequest")]
26+
pub struct PayloadInvalid {
27+
#[source]
28+
pub source: serde_json::Error,
29+
}
30+
31+
fn parse(input: &str) -> Result<(), AppError> {
32+
serde_json::from_str::<serde_json::Value>(input)
33+
.map(|_| ())
34+
.map_err(PayloadInvalid::from)
35+
}
36+
```
37+
38+
The derive implements `Display`, `std::error::Error`, and conversion glue so
39+
you can return rich `AppError` values with a single `?`.
40+
41+
## Supported attributes
42+
43+
- `#[error(display = ...)]` – formats the error message using captured fields.
44+
- `#[source]` / `#[from]` – wires source error propagation and conversion.
45+
- `#[backtrace]` – exposes an optional captured `Backtrace`.
46+
- `#[app_error(...)]` – configures how the error maps into `AppError`
47+
(kind, HTTP status, telemetry).
48+
- `#[provide(...)]` – attaches structured telemetry providers that surface
49+
typed context (IDs, domains, tenant information) through tracing layers.
50+
51+
See the main [`masterror` README](https://github.com/RAprogramm/masterror/blob/HEAD/README.md) for an end-to-end guide and
52+
advanced examples covering templated display strings, telemetry providers and
53+
OpenAPI/schema integrations.
54+
55+
## License
56+
57+
Licensed under either of
58+
59+
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/RAprogramm/masterror/blob/HEAD/LICENSE-APACHE) or
60+
<https://www.apache.org/licenses/LICENSE-2.0>)
61+
- MIT license ([LICENSE-MIT](https://github.com/RAprogramm/masterror/blob/HEAD/LICENSE-MIT) or <https://opensource.org/licenses/MIT>)
62+
63+
at your option.
64+
65+
Unless you explicitly state otherwise, any contribution intentionally submitted
66+
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be
67+
licensed as above, without any additional terms or conditions.
68+

masterror-template/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
[package]
22
name = "masterror-template"
3-
version = "0.3.1"
3+
version = "0.3.6"
44
rust-version = "1.90"
55
edition = "2024"
66
repository = "https://github.com/RAprogramm/masterror"
77
readme = "README.md"
88
description = "Template utilities for masterror and its derive macros"
9-
publish = false
109
license = "MIT OR Apache-2.0"
1110

1211
[dependencies]

masterror-template/README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# masterror-template
2+
3+
`masterror-template` packages the template parser shared by the [`masterror`][masterror] runtime crate and the [`masterror-derive`][derive] procedural macros. It understands the `#[error("...")]` formatting language popularised by `thiserror` v2, producing a structured representation that downstream code can inspect or render.
4+
5+
The crate is intentionally small: it exposes just enough API for advanced applications that want to inspect derived error displays, implement custom derive helpers, or perform static analysis over formatting placeholders.
6+
7+
## Installation
8+
9+
Add the crate alongside `masterror` if you need direct access to the parser:
10+
11+
```toml
12+
[dependencies]
13+
masterror-template = { version = "0.3.6" }
14+
```
15+
16+
`masterror-template` targets Rust 1.90 and builds on stable and nightly toolchains alike.
17+
18+
## Parsing templates
19+
20+
Call [`ErrorTemplate::parse`](https://docs.rs/masterror-template/latest/masterror_template/template/struct.ErrorTemplate.html#method.parse) to turn an `&str` into a structured template:
21+
22+
```rust
23+
use masterror_template::template::{ErrorTemplate, TemplateIdentifier};
24+
25+
fn inspect(template: &str) {
26+
let parsed = ErrorTemplate::parse(template).expect("valid template");
27+
28+
for placeholder in parsed.placeholders() {
29+
match placeholder.identifier() {
30+
TemplateIdentifier::Named(name) => println!("named placeholder: {name}"),
31+
TemplateIdentifier::Positional(index) => println!("positional placeholder: {index}"),
32+
TemplateIdentifier::Implicit(index) => println!("implicit placeholder: {index}"),
33+
}
34+
}
35+
}
36+
```
37+
38+
The parser preserves literal text and exposes every placeholder with span metadata, making it straightforward to surface diagnostics or transform templates programmatically.
39+
40+
## Formatter metadata
41+
42+
Each [`TemplatePlaceholder`](https://docs.rs/masterror-template/latest/masterror_template/template/struct.TemplatePlaceholder.html) advertises the requested formatter through [`TemplateFormatter`](https://docs.rs/masterror-template/latest/masterror_template/template/enum.TemplateFormatter.html) and [`TemplateFormatterKind`](https://docs.rs/masterror-template/latest/masterror_template/template/enum.TemplateFormatterKind.html):
43+
44+
```rust
45+
use masterror_template::template::{ErrorTemplate, TemplateFormatterKind};
46+
47+
let template = ErrorTemplate::parse("{value:#x}").expect("parse");
48+
let placeholder = template.placeholders().next().expect("placeholder");
49+
let formatter = placeholder.formatter();
50+
assert_eq!(formatter.kind(), TemplateFormatterKind::LowerHex);
51+
assert!(formatter.is_alternate());
52+
```
53+
54+
This mirrors the formatting traits accepted by `core::fmt`, enabling consumers to route values through `Display`, `Debug`, hexadecimal, binary, pointer, or exponential renderers.
55+
56+
## Error reporting
57+
58+
Parsing failures produce [`TemplateError`](https://docs.rs/masterror-template/latest/masterror_template/template/enum.TemplateError.html) variants with precise byte ranges. The metadata simplifies IDE integrations and procedural macros that need to point at the offending part of the template.
59+
60+
```rust
61+
use masterror_template::template::ErrorTemplate;
62+
63+
let err = ErrorTemplate::parse("{foo").unwrap_err();
64+
assert!(matches!(err, masterror_template::template::TemplateError::UnterminatedPlaceholder { .. }));
65+
```
66+
67+
## License
68+
69+
Dual licensed under either of
70+
71+
- Apache License, Version 2.0, ([LICENSE-APACHE](../LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
72+
- MIT license ([LICENSE-MIT](../LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
73+
74+
at your option.
75+
76+
### Contribution
77+
78+
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
79+
80+
[masterror]: https://crates.io/crates/masterror
81+
[derive]: https://crates.io/crates/masterror-derive

0 commit comments

Comments
 (0)