error-handling

Implement typed error handling in Effect TypeScript with Data.TaggedError and catchTag.

68|13|Updated Aug 9, 2025
One-click install
npx skills add https://github.com/kriegcloud/beep-effect --skill error-handling-kriegcloud
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/kriegcloud/beep-effect/tree/main/.repos/beep-effect/.cursor/skills/error-handling
Command: npx skills add https://github.com/kriegcloud/beep-effect --skill error-handling-kriegcloud

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you implement robust, type-safe error handling in Effect TypeScript, ensuring predictable application behavior and graceful recovery from failures.

Core Features & Use Cases

  • Typed Errors: Define and use Data.TaggedError for clear, categorized error states.
  • Error Handling Combinators: Learn to use catchTag, catchTags, and catchAll for precise error management.
  • Recovery Patterns: Implement strategies like retries, fallbacks, and error transformation.
  • Use Case: When an API call might fail due to network issues, invalid credentials, or resource not found, use this Skill to catch each specific error type and provide appropriate user feedback or fallback logic.

Quick Start

Use the error-handling skill to demonstrate catching a 'UserNotFound' error with catchTag.

Frequently Asked Questions about error-handling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle typed errors in Effect TypeScript?

Handle typed errors in Effect TypeScript by defining custom failures with Data.TaggedError and catching them precisely using catchTag, catchTags, or catchAll to manage specific error channels and ensure exhaustive matching across your application.

What is the best way to catch specific tagged errors in Effect?

The best way to catch specific tagged errors in Effect is using catchTag for individual error types or catchTags to handle multiple tags simultaneously, allowing you to target distinct failure states like UserNotFound or NetworkError without catching unrelated errors.

How do I implement error recovery patterns in Effect?

Implement error recovery patterns in Effect by using built-in combinators to define fallbacks, retry strategies, or error transformations, ensuring your application gracefully recovers from expected failures and maintains predictable behavior during domain-specific operations.

Why use Data.TaggedError for error handling in TypeScript?

Use Data.TaggedgedError for error handling in TypeScript to create clear, categorized error states with distinct tags, enabling the compiler to enforce exhaustive error matching and prevent unhandled failures in your Effect programs.

Can I transform errors into different types using Effect?

You can transform errors into different types using Effect by applying error handling combinators to map domain-specific failures into alternative tagged errors or unified error channels, ensuring consistent error propagation and recovery across application layers.

Does Effect support exhaustive error matching for tagged errors?

Effect supports exhaustive error matching for tagged errors by leveraging catchTag and catchTags, ensuring that every potential failure state defined by Data.TaggedError is explicitly handled during compilation to prevent uncaught runtime exceptions.