frontend-error-handling

Centralize API error handling in React with RFC 7807 normalization.

Updated Feb 25, 2026
One-click install
npx skills add https://github.com/chinomartinez/SmartPocket --skill frontend-error-handling-chinomartinez
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-error-handling
Source: https://github.com/chinomartinez/SmartPocket/tree/main/.agents/skills/frontend-error-handling
Command: npx skills add https://github.com/chinomartinez/SmartPocket --skill frontend-error-handling-chinomartinez

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Centralizes error management in the SmartPocket React application to provide consistent user feedback and reduce boilerplate.

Core Features & Use Cases

  • Centralized API error handling with automatic global toasts and automatic field-level mapping.
  • Error boundaries and automatic error display via ErrorAlert for global errors, plus useFormErrorHandler for field errors.
  • RFC 7807 Problem Details integration with a safe, typed ApiError shape and a normalized Axios interceptor.

Quick Start

Wrap your app in ErrorBoundary and enable automatic toasts to surface global errors, then wire useFormErrorHandler to map server errors to form fields.

Frequently Asked Questions about frontend-error-handling

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

FAQPage Schema
How do I centralize API error handling in a React application to reduce boilerplate?

Centralizing API error handling in React involves using an Axios interceptor to normalize responses into a typed ApiError shape, automatically triggering global toasts and mapping field-level errors to forms via a dedicated hook.

How does RFC 7807 Problem Details integration work for frontend error management?

RFC 7807 Problem Details integration standardizes frontend error management by normalizing API error responses into a safe, typed ApiError shape with an optional errors array, ensuring consistent error mapping across the React application.

What is the best way to map server API errors to individual form fields in React?

Mapping server API errors to React form fields is handled by a useFormErrorHandler hook, which takes the normalized ApiError array and automatically maps the server validation errors directly to their corresponding form fields.

How do I display global API errors in React while keeping field errors localized?

Displaying global API errors while keeping field errors localized requires wrapping the React app in an ErrorBoundary and using an ErrorAlert component for global display, alongside the useFormErrorHandler hook for field-specific mapping.

Do I need Axios to use this centralized React error handling approach?

Yes, the centralized React error handling approach requires Axios, as it implements a generic Axios interceptor specifically to intercept and normalize API error responses into the RFC 7807 Problem Details format.

Can I handle both global toast notifications and form-level errors with a single error handling setup?

Handling both global toast notifications and form-level errors simultaneously is achievable through a single centralized setup that enables automatic global toasts for server errors while routing field-specific errors through the useFormErrorHandler hook.