一键导入
error-handling-patterns
Error handling patterns and best practices. Use when implementing error handling, creating custom exceptions, or designing error responses.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Error handling patterns and best practices. Use when implementing error handling, creating custom exceptions, or designing error responses.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Aspire skill covering the Aspire CLI, AppHost orchestration, service discovery, integrations, MCP server, VS Code extension, Dev Containers, GitHub Codespaces, templates, dashboard, and deployment. Use when the user asks to create, run, debug, configure, deploy, or troubleshoot an Aspire distributed application.
Create ASP.NET Minimal API endpoints with proper OpenAPI documentation
Clean code principles for writing maintainable, readable code. Use when refactoring, code reviews, or writing new code to improve code quality.
Detailed coding standards and best practices including clean code, SOLID, and common patterns. Use when writing or reviewing code.
Containerize an ASP.NET Core project by creating Dockerfile and .dockerfile files customized for the project.
Create a README.md file for the project
| name | error-handling-patterns |
| description | Error handling patterns and best practices. Use when implementing error handling, creating custom exceptions, or designing error responses. |
| license | Apache 2.0 |
class AppError extends Error {
constructor(
public code: string,
message: string,
public statusCode: number
) {
super(message);
}
}
class ValidationError extends AppError {
constructor(message: string) {
super('VALIDATION_ERROR', message, 400);
}
}
class NotFoundError extends AppError {
constructor(resource: string) {
super('NOT_FOUND', `${resource} not found`, 404);
}
}
try {
await service.process(data);
} catch (error) {
if (error instanceof ValidationError) {
logger.warn('Validation failed', { error, data });
throw error;
}
logger.error('Unexpected error', { error, data });
throw new InternalServerError('Processing failed');
}
{
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": [
{ "field": "email", "message": "Invalid email format" }
]
}
}