Skip to content

docs: yieldable TaggedErrors and multi-tag catchTag - #5

Open
danielo515 wants to merge 12 commits into
Makisuo:mainfrom
danielo515:fix/yieldable-errors-and-multi-tag-catchTag
Open

danielo515 wants to merge 12 commits into
Makisuo:mainfrom
danielo515:fix/yieldable-errors-and-multi-tag-catchTag

Conversation

@danielo515

Copy link
Copy Markdown

Summary

  • Remove redundant Effect.fail() wrappers: Schema.TaggedError instances are yieldable (they implement the Effect interface), so Effect.fail(new SomeError(...)) is replaced with just new SomeError(...) across all examples in 6 files
  • Document multi-tag catchTag: Effect.catchTag accepts variadic tag strings (catchTag("A", "B", "C", handler)) for mapping multiple errors to a single handler, eliminating the need for catchTags with duplicate handler bodies
  • Add "TaggedErrors Are Yieldable" section in error-patterns.md with clear ✅/❌ examples and a note that plain Error objects still require Effect.fail()

Test plan

  • Verify all code examples are syntactically correct
  • Confirm GenericError in FORBIDDEN examples still uses Effect.fail() (not a TaggedError)
  • Review multi-tag catchTag examples match current Effect API

…lock examples

Add comprehensive documentation for:
- Test variants (it.effect, it.live, it.scoped, it.scopedLive)
- Effect-specific assertion utilities from @effect/vitest/utils
- Error testing patterns including Effect.flip for simpler assertions
- TestClock usage for time-dependent testing with delays, recurring effects, and Deferred
- Add blank lines after "**Correct:**" headers for consistent formatting
- Remove unnecessary line breaks in yield* statements
- Add new anti-pattern section for deprecated `_` adaptor in Effect.gen
- Fix Schema.TaggedStruct usage example with missing tag parameter
- Remove unnecessary line break in yield* statement
- Replace deprecated Config.secret with Config.redacted across all examples
- Update secret configuration examples in observability patterns
Add navigation tables of contents to:
- anti-patterns.md
- effect-atom-patterns.md
- effect-test-patterns.md
- error-patterns.md
- layer-patterns.md
- observability-patterns.md
- rpc-cluster-patterns.md
- schema-patterns.md
- service-patterns.md
Add comprehensive documentation for:
- Equivalence and Order instances derived from schemas
- Field-based comparisons using mapInput
- Combining equivalences and orders for multi-criteria operations
- Complete checklist for schedulable and durable types
- Usage examples with Array operations

Update layer-patterns.md with:
- Layer type signature explanation
- Merge vs Provide comparison section
…ommon patterns

Add comprehensive documentation for:
- Function atoms (Atom.fn) for side effects with cart example
- Runtime with services including global layer configuration
- useAtomSetPromise hook for async function atoms
- Stream integration for real-time data
- Pull atoms for pagination patterns
- Scoped resources with automatic cleanup using acquireRelease
- Common patterns: loading states, optimistic updates, and computed queries
…amples

TaggedError instances implement the Effect interface, so Effect.fail()
wrapping is unnecessary. Also document that catchTag accepts variadic
tag strings for mapping multiple errors to a single handler, reducing
boilerplate vs catchTags with duplicate handler bodies.
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