Skip to content

Improve error API and project quality - #1

Merged
ardhitama merged 1 commit into
masterfrom
agent/improve-error-api-and-quality
Jul 14, 2026
Merged

ardhitama merged 1 commit into
masterfrom
agent/improve-error-api-and-quality

Conversation

@ardhitama

@ardhitama ardhitama commented Jul 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • make Errx.match/2 total and correctly compare two wrapped errors
  • replace fixed stack offsets with caller-frame scanning and add structured locations
  • formalize metadata replacement, metadata merging, and cause-chain behavior
  • use binary-only exception messages and retain arbitrary bitstrings as data
  • strengthen types, documentation, tests, package metadata, and compatibility guidance
  • add a CI matrix for the oldest supported Elixir release and the latest stable Elixir/OTP combination, including formatting, warnings, tests, Credo, package construction, and Dialyzer

Why

The previous implementation depended on hard-coded stack indexes, allowed match/2 to raise for ordinary inputs, discarded existing parent chains, and left several public semantics undocumented. The project README and package metadata were also stale, and there was no automated validation.

Developer impact

The standard {:error, %Errx{}} return shape and the legacy file, func, metadata/2, and wrap(parent, child) interfaces remain available. New code can use:

  • location for structured caller information
  • put_metadata/2 and merge_metadata/2 for explicit metadata semantics
  • with_parent/2 and cause/1 for clearer cause-chain handling

The minimum supported Elixir version is now 1.14, and the package version is prepared as 0.5.0.

Validation

This branch is exactly one commit ahead of master.

GitHub Actions passes on:

  • Elixir 1.14.5 / OTP 25.3
  • Elixir 1.20.2 / OTP 29.0.3

Checks include:

  • mix format --check-formatted
  • mix compile --warnings-as-errors
  • 24 passing tests and doctests
  • mix credo --strict
  • mix hex.build
  • Dialyzer on the latest matrix entry

@ardhitama
ardhitama force-pushed the agent/improve-error-api-and-quality branch 6 times, most recently from 9d2b8d9 to 36d328d Compare July 14, 2026 15:37
@ardhitama
ardhitama force-pushed the agent/improve-error-api-and-quality branch from 36d328d to b5aaeb6 Compare July 14, 2026 15:40
@ardhitama
ardhitama marked this pull request as ready for review July 14, 2026 15:45
@ardhitama
ardhitama merged commit 34e49f2 into master Jul 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant