1k-error-handling_skill

This skill helps you implement robust error handling patterns across async calls, UI states, and user notifications for reliable applications.
  • TypeScript

2.3k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill onekeyhq/app-monorepo --skill 1k-error-handling

  • SKILL.md3.6 KB

Overview

This skill describes pragmatic error handling patterns used across a secure, cross-platform crypto wallet codebase. It covers try/catch usage, async error management, React error boundaries, a useAsyncCall hook pattern, and user-facing toast messages. The guidance focuses on reliable user experience, clear logging for debugging, and avoiding silent failures.

How this skill works

The skill inspects common async flows and UI state handling, showing where to wrap operations in try/catch, when to return fallbacks, and how to propagate errors. It demonstrates integrating a useAsyncCall hook to manage loading, result, and error states, and how to display toast notifications for success or user-friendly failures. It also highlights anti-patterns like silent swallowing and missing error UI states.

When to use it

  • Any async operation that can fail (network calls, wallet operations, signing).
  • Components that fetch data and must show loading, success, or error states.
  • Forms and submit flows where users need clear success/failure feedback.
  • Critical flows requiring error logging and re-throwing for upstream handlers.
  • UI boundaries where React error boundaries can prevent full app crashes.

Best practices

  • Always wrap async work in try/catch; log the error and decide to re-throw or provide a fallback.
  • Use useAsyncCall (or equivalent) for components to centralize loading, result, and error handling.
  • Show user-friendly toast messages for errors and successes; log detailed errors for debugging.
  • Never silently swallow errors—at minimum console.error or forward to a monitoring tool.
  • Handle specific error types when possible (network, validation, auth) to provide precise messages.

Example use cases

  • Fetching account balances with a fallback value when remote service is unavailable.
  • Form submission that shows success toast, or error toast with a friendly message and logs details.
  • Component using useAsyncCall to load transaction history and rendering an ErrorView with retry.
  • Wrapping wallet signing calls with try/catch to surface key errors and avoid silent failures.
  • Adding React error boundaries around critical UI sections to capture rendering exceptions.

FAQ

Re-throw when the caller must know about the failure; otherwise handle locally and provide a meaningful fallback or user message.

When is a fallback acceptable instead of throwing?

Use fallbacks for non-critical data where degraded functionality is acceptable and keeps the UI usable.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
1k-error-handling skill by onekeyhq/app-monorepo | VeilStrat