nestjs-error-handling
БесплатноБез исполняемых скриптовНе проверенImplement Global Exception Filters and standard error formats in NestJS. Use when implementing global exception filters or standardizing error responses in…
от HoangNguyen0403★ 598 звёзд на GitHubОб этом скилле
NestJS Error Handling Standards
Priority: P1 (HIGH)
- Requirement: Centralize error formatting.
- Platform Agnostic: not import
Request/Responsefrom Express/Fastify types directly. - Use:
HttpAdapterHostto access underlying platform response methods. const { httpAdapter } = this.httpAdapterHost;- Structure:
- Implement strictly typed error responses.
- Refer to API Standards for
ApiErrorResponse.
{
"statusCode": 400,
"message": "Validation failed",
"error": "Bad Request",
"timestamp": "ISO...",
"path": "/users"
}
Error Flow
- Service: Throws specific or generic errors (e.g.,
EntityNotFoundError). - Interceptor: Maps low-level errors to HTTP Exceptions (e.g.,
catchError(err => throw new NotFoundException())).
- Why: Keeps Exception Filters focused on formatting, not business logic interpretation.
- Global Filter: Formats final JSON response.
Built-in Exceptions
- Use: Throw
NotFoundException,ForbiddenException,BadRequestException. - Custom: Extend
HttpExceptiononly for domain-specific failures that need specific status codes.
Logging
- Context: Always pass
MyClass.nametoLoggerconstructor. - Levels:
error: 500s (Stack trace required).warn: 400s (Client errors).
Security (Information Leakage)
- Production: NEVER expose stack traces in HTTP responses (
process.env.NODE_ENV === 'production'). - Sanitization: Ensure
ApiExceptionpayloads not leak internal file paths or raw variable dumps.
Anti-Patterns
- No stack traces in production: Gate stack exposure behind
NODE_ENV === 'production'check. - No Express types in filters: Use
HttpAdapterHostfor platform-agnostic error handling. - No HttpException in services: Throw domain errors in services; let Interceptors map to HTTP exceptions.
Установить nestjs-error-handling в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл nestjs-error-handling?
Implement Global Exception Filters and standard error formats in NestJS. Use when implementing global exception filters or standardizing error responses in NestJS.
Как установить скилл nestjs-error-handling?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл nestjs-error-handling запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic