error-handling

Standardize server and client error handling with consistent logs and safe responses.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/Norfolk-Group/H-Analytics --skill error-handling-norfolk-group
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling
Source: https://github.com/Norfolk-Group/H-Analytics/tree/main/.claude/archive/agents-skills-snapshot/error-handling
Command: npx skills add https://github.com/Norfolk-Group/H-Analytics --skill error-handling-norfolk-group

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a consistent, production-grade approach to catching, logging, and responding to errors across server routes and client UI so crashes are contained, diagnostics are reliable, and user-facing failures remain graceful.

Core Features & Use Cases

  • Standardized server helpers for unexpected and known errors: logAndSendError for 500-level failures and sendError for validation and not-found responses.
  • Validation handling pattern using Zod with readable fromZodError messages for client-friendly 400 responses.
  • Non-blocking side effects via fire-and-forget logging that never breaks the primary request flow.
  • Client error boundaries including a top-level ErrorBoundary, a SelfHealingBoundary with exponential backoff, and a FinancialErrorBoundary tailored to calculation components.
  • FinancialCalculationError class with deterministic input hashing and Sentry tag helpers to deduplicate and contextualize engine failures.
  • Sentry integration configured for graceful degradation, environment-specific sampling, and safe client reporting.
  • Rules and checklist enforcing typed catch blocks, no empty catch swallowing, and placement of boundaries and helpers across the app.

Quick Start

Wrap server route handlers with logAndSendError for unexpected failures and add FinancialErrorBoundary around calculation UIs while using SelfHealingBoundary for transient async sections.

Frequently Asked Questions about error-handling

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

FAQPage Schema
What's the best way to standardize error handling across server routes and client components in TypeScript?

Standardize error handling by wrapping server route handlers with logAndSendError for 500-level failures and sendError for validation responses, while placing ErrorBoundary components around client UI sections to contain crashes and maintain graceful user-facing failures.

How do I return client-friendly validation errors from Zod schemas in a server route?

Return client-friendly Zod validation errors by applying the readable fromZodError messages format to generate structured 400 responses. Use the sendError helper to ensure validation failures are communicated clearly to the client without exposing internal implementation details.

How do I prevent fire-and-forget logging from breaking my primary server request flow?

Prevent fire-and-forget logging from breaking server request flow by enforcing non-blocking side effects. This approach ensures that activity logging and Sentry reporting execute asynchronously without interrupting the primary request processing, maintaining reliable and consistent application performance.

Can I use a self-healing error boundary with exponential backoff for transient async failures?

Yes, you can use a SelfHealingBoundary to handle transient async failures through automated retry logic with exponential backoff. This component automatically recovers failed UI sections without requiring a full page reload, ensuring resilient client-side error recovery.

How do I track and deduplicate financial calculation errors with deterministic input fingerprinting?

Track and deduplicate financial calculation errors by implementing the FinancialCalculationError class, which uses deterministic input hashing to generate unique fingerprints. Sentry tag helpers contextualize these engine failures, preventing duplicate reports and improving diagnostic reliability.

Does this error handling approach support graceful degradation when Sentry reporting fails?

Yes, this error handling approach supports graceful Sentry degradation. It is configured with environment-specific sampling and safe client reporting rules, ensuring that if Sentry operations fail, the primary application flow remains completely unaffected and stable.