Skip to content

Replace string-based error variants with structured fields#107

Merged
ryanoneill merged 1 commit intomainfrom
feature/structured-errors
Mar 2, 2026
Merged

Replace string-based error variants with structured fields#107
ryanoneill merged 1 commit intomainfrom
feature/structured-errors

Conversation

@ryanoneill
Copy link
Owner

Summary

  • Replace Render(String), Config(String), Subscription(String) with named-field struct variants that expose component/field/type context
  • Add convenience constructors EnvisionError::render(), ::config(), ::subscription() for ergonomic creation
  • Update Display and Error::source() impls for the new structured variants
  • Add field-accessibility tests to verify pattern matching works

Test plan

  • cargo test — all 2885 tests pass
  • cargo clippy -- -D warnings — clean
  • cargo check --no-default-features — compiles
  • cargo test --doc — 270 doc tests pass
  • cargo build --examples — compiles

🤖 Generated with Claude Code

EnvisionError::Render, Config, and Subscription now carry named fields
instead of a single String, enabling callers to match on specific
failure modes. Convenience constructors (render(), config(),
subscription()) provide ergonomic creation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@codecov-commenter
Copy link

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 92.64%. Comparing base (41832db) to head (ff008f3).

Files with missing lines Patch % Lines
src/error.rs 93.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #107      +/-   ##
==========================================
- Coverage   92.65%   92.64%   -0.02%     
==========================================
  Files          99       99              
  Lines        9491     9503      +12     
==========================================
+ Hits         8794     8804      +10     
- Misses        697      699       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ryanoneill ryanoneill merged commit b5d1515 into main Mar 2, 2026
12 of 13 checks passed
@ryanoneill ryanoneill deleted the feature/structured-errors branch March 2, 2026 04:57
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.

2 participants