tsentials-errors

Create typed AppError values with metadata for TypeScript error handling.

49|Updated May 12, 2026
One-click install
npx skills add https://github.com/senrecep/tsentials --skill tsentials-errors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: tsentials-errors
Source: https://github.com/senrecep/tsentials/tree/main/.well-known/agent-skills/tsentials-errors
Command: npx skills add https://github.com/senrecep/tsentials --skill tsentials-errors

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

This Skill solves the problem of handling errors as structured, typed values instead of untyped exceptions, so your application can return consistent error codes, descriptions, and metadata across sync and async flows.

Core Features & Use Cases

  • Create rich AppError values using Err factories for failure, validation, notFound, conflict, unauthorized, forbidden, and unexpected outcomes.
  • Attach and manage error metadata with ErrorMetadata as a ReadonlyMap, generated from plain records or caught exceptions.
  • Convert exceptions into typed errors via Err.fromException and optionally override both the error type and code.
  • Combine and compare errors using Err.combine (collect multiple AppErrors) and Err.equals (structural equality by code/description/type).

Quick Start

Use the tsentials-errors skill to define an AppError for a failing request by calling Err.validation('User.InvalidAge', 'Must be 18+', ErrorMetadata.fromRecord({ field: 'age', value: 15 })).

Frequently Asked Questions about tsentials-errors

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

FAQPage Schema
How do I create typed error values in TypeScript instead of throwing untyped exceptions?

You can create typed error values in TypeScript by using Err factory methods like Err.validation or Err.failure to build structured AppError objects with consistent error codes, descriptions, and metadata instead of relying on untyped exceptions.

How do I attach metadata to structured TypeScript errors?

You can attach metadata to structured TypeScript errors by using ErrorMetadata helpers such as fromRecord to generate a ReadonlyMap, passing it directly into Err factory methods like Err.validation when creating your typed AppError values.

What is the best way to convert caught exceptions into typed error objects in TypeScript?

The best way to convert caught exceptions into typed error objects is using Err.fromException, which transforms untyped caught exceptions into structured AppError values while allowing you to optionally override the error type and code.

Can I combine multiple TypeScript errors into a single collection?

Yes, you can combine multiple TypeScript errors into a single collection by using Err.combine, which collects multiple AppError objects together, and you can also use Err.equals to check structural equality by code, description, and type.

Why should I use structured error handling instead of standard exceptions in TypeScript?

Structured error handling in TypeScript ensures your application returns consistent error codes, descriptions, and metadata across sync and async flows, avoiding the unpredictability and lack of type safety associated with throwing untyped exceptions.

Do I need an ErrorType enum to use the tsentials-errors Skill?

Yes, using this Skill requires an ErrorType enum alongside Err factory methods and ErrorMetadata helpers, and you must use the .description property rather than .message when defining your typed AppError values.