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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ All notable changes to this project will be documented in this file.
### Added
- `masterror::error::template` module providing a parsed representation of
`#[error("...")]` strings and a formatter hook for future custom derives.
- Internal `masterror-derive` crate powering the native `masterror::Error`
derive macro.

### Changed
- `masterror::Error` now uses the in-tree derive, removing the dependency on
`thiserror` while keeping the same runtime behaviour and diagnostics.

## [0.5.0] - 2025-09-23

Expand Down
17 changes: 16 additions & 1 deletion Cargo.lock

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

9 changes: 8 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ build = "build.rs"
categories = ["rust-patterns", "web-programming"]
keywords = ["error", "api", "framework"]

[workspace]
members = [
"masterror-derive",
"masterror-template"
]


[features]
default = []
Expand All @@ -33,7 +39,8 @@ turnkey = []
openapi = ["dep:utoipa"]

[dependencies]
thiserror = "2"
masterror-derive = { path = "masterror-derive" }
masterror-template = { path = "masterror-template" }
tracing = "0.1"

serde = { version = "1", features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ masterror = { version = "0.5.0", default-features = false }
- **Clean wire contract.** `ErrorResponse { status, code, message, details?, retry?, www_authenticate? }`.
- **One log at boundary.** Log once with `tracing`.
- **Less boilerplate.** Built-in conversions, compact prelude, and the
`masterror::Error` re-export of `thiserror::Error` with `#[from]` /
`#[error(transparent)]` support.
native `masterror::Error` derive with `#[from]` / `#[error(transparent)]`
support.
- **Consistent workspace.** Same error surface across crates.

</details>
Expand Down Expand Up @@ -142,7 +142,7 @@ let wrapped = WrappedDomainError::from(err);
assert_eq!(wrapped.to_string(), "I/O failed: disk offline");
~~~

- `use masterror::Error;` re-exports `thiserror::Error`.
- `use masterror::Error;` brings the crate's derive macro into scope.
- `#[from]` automatically implements `From<...>` while ensuring wrapper shapes are
valid.
- `#[error(transparent)]` enforces single-field wrappers that forward
Expand Down
6 changes: 3 additions & 3 deletions README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ masterror = { version = "{{CRATE_VERSION}}", default-features = false }
- **Clean wire contract.** `ErrorResponse { status, code, message, details?, retry?, www_authenticate? }`.
- **One log at boundary.** Log once with `tracing`.
- **Less boilerplate.** Built-in conversions, compact prelude, and the
`masterror::Error` re-export of `thiserror::Error` with `#[from]` /
`#[error(transparent)]` support.
native `masterror::Error` derive with `#[from]` / `#[error(transparent)]`
support.
- **Consistent workspace.** Same error surface across crates.

</details>
Expand Down Expand Up @@ -136,7 +136,7 @@ let wrapped = WrappedDomainError::from(err);
assert_eq!(wrapped.to_string(), "I/O failed: disk offline");
~~~

- `use masterror::Error;` re-exports `thiserror::Error`.
- `use masterror::Error;` brings the crate's derive macro into scope.
- `#[from]` automatically implements `From<...>` while ensuring wrapper shapes are
valid.
- `#[error(transparent)]` enforces single-field wrappers that forward
Expand Down
13 changes: 13 additions & 0 deletions masterror-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "masterror-derive"
version = "0.1.0"
edition = "2024"

[lib]
proc-macro = true

[dependencies]
proc-macro2 = "1"
quote = "1"
syn = { version = "2", features = ["full", "extra-traits"] }
masterror-template = { path = "../masterror-template" }
Loading
Loading