stacks-error-handling

Standardize error management with Result types and centralized handlers in Stacks.

2|Updated Jul 8, 2026
One-click install
npx skills add https://github.com/bughq/bughq --skill stacks-error-handling-bughq
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: stacks-error-handling
Source: https://github.com/bughq/bughq/tree/main/.claude/skills/stacks-error-handling
Command: npx skills add https://github.com/bughq/bughq --skill stacks-error-handling-bughq

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @stacksjs/error-handling.

What problem does it solve?

This Skill addresses the complexity of managing application errors by providing a unified, type-safe framework for capturing, logging, and displaying errors in Stacks applications.

Core Features & Use Cases

  • Result Pattern: Replaces traditional try/catch blocks with Result types (Ok/Err) for predictable, recoverable error flows.
  • Unified Error Handling: Provides a centralized ErrorHandler class for logging to files, console, and managing application exits.
  • Environment-Aware Rendering: Automatically switches between detailed stack traces for development and user-friendly messages for production.
  • Use Case: Use this to standardize how your application handles database failures, validation errors, or missing models across your entire codebase.

Quick Start

Use the stacks-error-handling skill to implement a Result-based error check for your current function and configure the appropriate error page rendering.

Frequently Asked Questions about stacks-error-handling

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

FAQPage Schema
How do I implement type-safe error handling in TypeScript?

Type-safe error handling in TypeScript can be implemented using Result types (Ok/Err) to replace traditional try/catch blocks, ensuring predictable and recoverable error flows within your application logic.

What is the best way to standardize exception logging in a Stacks application?

Standardizing exception logging in a Stacks application is achieved through a centralized ErrorHandler class that manages consistent logging to files and console, while also controlling application exits during failures.

How does environment-aware error page rendering work for development and production?

Environment-aware error page rendering automatically switches between displaying detailed stack traces for development environments and user-friendly messages for production environments based on the application's current runtime state.

Can I use Result types instead of try/catch blocks for validation errors?

Yes, using Result types instead of try/catch blocks for validation errors provides a structured, type-safe control flow mechanism to handle recoverable failures like missing models or invalid input data.

Does the Stacks framework handle HTTP status mapping for missing models automatically?

The Stacks framework handles HTTP status mapping automatically through its centralized error management system, which intercepts exceptions like ModelNotFound and maps them to their appropriate HTTP response codes.