Releases: RAprogramm/masterror
Releases · RAprogramm/masterror
v0.17.0
Added
- Per-field redaction metadata via a new [
FieldRedaction] enum, default
heuristics for common secret keys (passwords, tokens, card numbers) and the
Context::redact_field/AppError::redact_fieldhelpers. #[masterror(redact(fields(...)))]support in the derive macro to configure
metadata policies alongside message redaction.- Opt-in internal formatters for [
ErrorResponse] and [ProblemJson] that are
safe to use in diagnostic logs without additional serialization boilerplate.
Changed
- Problem JSON and legacy
ErrorResponseserialization now hash, mask or drop
metadata according to per-field policies while honoring the global redaction
flag. - Redaction-aware conversions ensure redactable messages fall back to the error
kind across HTTP and gRPC mappings.
v0.16.0
Changed
- Switched the internal
AppErrorsource storage toArc<dyn Error>and added a
sharedwith_source_archelper so conversions can reuse existingArc
handles without extra allocations. - Replaced the backtrace slot with an
Option<Backtrace>managed through an
environment-aware lazy capture that respectsRUST_BACKTRACEand avoids
snapshot allocation when disabled. - Updated the
masterror::Errorderive andResultExtconversions to forward
sources using the new shared storage while preserving error chains.
Tests
- Added regression coverage for the
std::error::Errorchain,Arcsource
preservation in the derives, and conditional backtrace capture driven by the
RUST_BACKTRACEenvironment variable.
v0.15.0
Added
- Introduced a
response::problem_jsonmodule with an RFC7807ProblemJson
payload that serializes metadata, gRPC mappings and retry/authentication
hints while respecting the message redaction policy. - Added an optional
tonicfeature exposingTryFrom<Error> for tonic::Status
with sanitized metadata and canonical gRPC code mapping. - Published a compile-time
CODE_MAPPINGStable mapping eachAppCodeto
HTTP, gRPC and problem type information for reuse across transports.
Changed
- Updated Axum and Actix integrations to emit
application/problem+json
bodies, attachRetry-After/WWW-Authenticateheaders automatically and
avoid leaking redactable messages or metadata. - Re-exported
ProblemJsonfrom the crate root alongsideErrorResponsefor
direct construction in custom handlers.
Tests
- Added unit coverage for the problem+json metadata sanitizer, header
propagation in Axum, and gRPC code mapping under the newtonicfeature.
v0.14.1
Changed
- Boxed the internal
AppErrorpayload inside a newErrorInnerallocation,
keeping public field access viaDerefwhile shrinking the error to a
pointer-sized handle that shares metadata, retry hints, and backtrace state.
Removed
- Dropped
clippy::result_large_errallowances in response helpers and tests
now thatAppErroris pointer-sized and lint-clean without suppressions.
Fixed
- Removed the unused
BacktraceSlot::gethelper to restore builds with-D warnings. - Simplified the metrics recorder test harness with dedicated types to satisfy
clippy::type_complexitywithout sacrificing coverage.
v0.14.0
Added
- Introduced optional
tracing,metricsandbacktracefeatures. When
enabled they emit structuredtracingevents, increment the
error_total{code,category}counter and capture lazy [Backtrace] snapshots
from a newAppError::emit_telemetryhook.
Changed
- Reworked the
AppErrorcore to emit telemetry exactly once, track dirty
mutations and expose a crate-privatenew_rawconstructor for contexts that
enrich errors before flushing instrumentation. - Updated Axum and Actix integrations to rely on the telemetry hook instead of
manually logging errors while preserving backward-compatible APIs.
Tests
- Added tracing dispatcher coverage to assert a single telemetry event with MDC
propagatedtrace_idvalues. - Installed a deterministic metrics recorder in unit tests to confirm
error_totalincrements once per error.
v0.13.1
Fixed
- Documented allowances for
clippy::result_large_erron APIs that intentionally
expose the richAppErrorpayload, restoring lint-clean builds.
v0.13.0
Added
- Introduced
#[derive(Masterror)]and the#[masterror(...)]attribute to
convert domain errors directly into [masterror::Error] while capturing
metadata, message redaction policy and optional transport mappings. - Added transport mapping descriptors in
mapping::{HttpMapping, GrpcMapping, ProblemMapping}generated by the new derive for HTTP/gRPC/problem-json
integrations.
Changed
- Re-exported the
Masterrorderive from the crate root alongside the existing
Errorderive.
Documentation
- Expanded crate docs and both READMEs with
Masterrorexamples, telemetry
guidance and redaction policy notes.
Tests
- Added integration tests and trybuild coverage exercising the
#[masterror(...)]attribute and generated mapping tables.
v0.12.1
Added
- Introduced the
Contextbuilder for enriching error conversions with
metadata, caller tracking, and redaction hints viaResultExt::ctx. - Implemented the
ResultExttrait to wrap fallible operations into
masterror::Errorwithout extra allocations while merging context fields.
Documentation
- Added rustdoc examples showcasing
Contextchaining and the new
ResultExthelper.
Tests
- Added unit coverage for
ResultExt::ctx, ensuring happy-path results pass
through and error branches preserve metadata and sources.
v0.12.0
Added
- Introduced typed
Metadatastorage withField/FieldValuebuilders and helper functions infield::*. - Captured error sources and backtraces inside the new
app_error::Errorcontainer, exposingMessageEditPolicyto control redaction.
Changed
- Replaced the legacy
AppErrorstruct with the richerErrormodel carryingAppCode, metadata, retry/auth hints and transport policy. - Updated response mapping and constructors to preserve machine-readable codes without extra allocations.
Documentation
- Refreshed crate docs, README (EN/RU) and examples to highlight metadata helpers and the new error contract.
Tests
- Added regression coverage ensuring codes, metadata and sources survive conversions without unnecessary cloning.
v0.11.2
Changed
- Surfaced the [
AppErrorKind] display text as the fallbackErrorResponse
message so clients receive semantic descriptions without providing a custom
message.
Tests
- Added regression coverage ensuring bare
AppErrorkinds map to their
corresponding default message.