View Source Changelog
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
[1.0.0] - 2026-06-03
First stable release. As of 1.0.0 the public API — the error struct shape, the
Errata guards and helper functions, the generated Errata.Error callbacks, and
the to_map/1 / JSON and [:errata, :error] telemetry shapes — is covered by
Semantic Versioning.
Added
- Context enrichment:
Errata.put_context/3andErrata.merge_context/2add to an error's:contextas it propagates, so intermediate layers can attach context the creation site did not have without rebuilding the struct. (#18) - Declared reasons: error types can now enumerate their valid reasons with the
:reasonsoption (use Errata.DomainError, reasons: [...]). Creating an error with a reason outside the declared set raises anArgumentError(anilreason is always allowed); a:default_reason, if given, must be one of the declared reasons; and areason/0type enumerating them is generated for the docs. (#20) - Error reporting:
Errata.log/2logs an error at a given level with itsreason,kind,context, and origin attached as structured Logger metadata;Errata.report/2emits a[:errata, :error]telemetry event (and optionally logs), providing a vendor-neutral seam for forwarding errors to Sentry, metrics, etc. via a telemetry handler in your application. Adds atelemetry ~> 1.0dependency. (#19) - HTTP status mapping: each error type now has a generated, overridable
http_status/1function (and a matchingErrata.http_status/1) that defaults off the error's kind (:domain→422,:infrastructure→503,:general→500). Set a specific status with the:http_statusoption, or override the function to compute one from the error. No web-framework dependency is added. (#21)
[0.10.0] - 2026-06-02
Added
- Error wrapping (chaining): error types can now carry a
:cause— the original error, exception, or value that led to them — without losing the context of the underlying failure.- A generated
wrap/1,2macro on each error module wraps a caught error as the:causeof a new error, capturing the current__ENV__(likecreate/1) and, when givenstacktrace: __STACKTRACE__, the original error's stacktrace. new/1,create/1, andraise/2now also accept a:causeparam.- The cause is stored as an
Errata.Causestruct (kind/value/stacktrace). Errata.cause/1returns the immediate cause;Errata.root_cause/1walks the chain to the deepest cause;Errata.format_chain/1renders the fullCaused by:chain for logging.to_map/1(and JSON) now include the cause, recursing into wrapped Errata errors and rendering standard exceptions by type and message.
- A generated
[0.9.0] - 2026-06-02
Added
Errata.create/2macro to create an error of any type while capturing the current env, without a separaterequirefor each error module. (#4)Errata.to_map/1to convert any Errata error to a plain, JSON-encodable map without needing to know the error's specific module. (#5)Errata.display_message/1to retrieve the bare, human-readable:messageof an error (without the:reasonsuffix thatException.message/1appends), for rendering errors to end users. (#7)
Changed
- Breaking:
new/1,create/1, andraise/2now raise anArgumentErrorwhen given unrecognized param keys instead of silently ignoring them. Only:message,:reason, and:contextare accepted. Callers that previously relied on extra keys being dropped will need to remove them. (#3)
Fixed
- Serialized error maps (
to_map/1) and their JSON form no longer leak theElixir.prefix on module names:error_typeandenv.moduleare now rendered as e.g."MyApp.Foo"(as strings rather than raw atoms), andenv.file_lineno longer includes a trailing colon. (#6)