server-error-handling

Wrap server-side errors with typed ORPC error codes.

1|Updated Nov 19, 2025
One-click install
npx skills add https://github.com/CatOfJupit3r/ultimate-starter --skill server-error-handling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: server-error-handling
Source: https://github.com/CatOfJupit3r/ultimate-starter/tree/main/.github/skills/server-error-handling
Command: npx skills add https://github.com/CatOfJupit3r/ultimate-starter --skill server-error-handling

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardizes server-side error handling by wrapping errors with typed codes using the ORPC error wrappers.

Core Features & Use Cases

  • Ensures all errors are wrapped with predefined error codes to prevent leakage and provide uniform responses.
  • Provides clear access-control patterns (UNAUTHORIZED, NOT_FOUND, FORBIDDEN) and guidance for adding new error codes.
  • Includes example patterns and integration guidance to reduce boilerplate and mistakes in protected procedures.

Quick Start

Follow the patterns in examples/error-handling-patterns.ts to wrap errors with the provided ORPC wrappers in your protected handlers.

Frequently Asked Questions about server-error-handling

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

FAQPage Schema
How do I standardize server error handling in TypeScript with ORPC?

Standardize server error handling in TypeScript by wrapping errors with predefined ORPC error codes like NOT_FOUND, FORBIDDEN, UNAUTHORIZED, and BAD_REQUEST. This enforces consistent responses across protected routes and services while preventing raw error leakage.

What is the best way to handle authorization errors in protected ORPC procedures?

Handle authorization errors in protected ORPC procedures by throwing typed wrappers such as UNAUTHORIZED or FORBIDDEN instead of raw errors. Using shared error enums ensures uniform access-control patterns and consistent server responses across the codebase.

How do I prevent raw server errors from leaking in ORPC API responses?

Prevent raw server errors from leaking by consistently wrapping them with ORPC error wrappers in your handlers and services. This approach replaces raw exceptions with predefined typed codes, providing uniform and safe responses to clients.

Can I add custom error codes to the ORPC error handling patterns?

You can add custom error codes by extending the shared error enums and applying the correct ORPC wrapper in your handlers. The Skill provides integration guidance to reduce boilerplate and mistakes when introducing new access-control or validation patterns.

Why should I avoid throwing raw errors in TypeScript server handlers?

Throwing raw errors in TypeScript server handlers breaks consistency and risks leaking sensitive information. Wrapping exceptions with typed ORPC codes like BAD_REQUEST enforces a standardized, predictable response format across all protected routes and services.