Skills Plugins MCP Prompt Model 博客 我的中心
开发编程 #design #api

error-handling-patterns

Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability.

DeepseekModel 官方收录技能 质量 优秀 · 90 v1.0.0

获取

https://deepseekmodel.com/api/download.php?id=wshobson-agents-plugins-developer-essentials-skills-error-handling-patterns-skill-md&format=skill
下载 .skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用
.skill 文件中 system_prompt 字段的实际内容。
name error-handling-patterns description Master error handling patterns across languages including exceptions, Result types, error propagation, and graceful degradation to build resilient applications. Use when implementing error handling, designing APIs, or improving application reliability. Error Handling Patterns Build resilient applications with robust error handling strategies that gracefully handle failures and provide excellent debugging experiences. When to Use This Skill Implementing error handling in new features Designing error-resilient APIs Debugging production issues Improving application reliability Creating better error messages for users and developers Implementing retry and circuit breaker patterns Handling async/concurrent errors Building fault-tolerant distributed systems Core Concepts 1. Error Handling Philosophies Exceptions vs Result Types: Exceptions : Traditional try-catch, disrupts control flow Result Types : Explicit success/failure, functional approach Error Codes : C-style, requires discipline Option/Maybe Types : For nullable values When to Use Each: Exceptions: Unexpected errors, exceptional conditions Result Types: Expected errors, validation failures Panics/Crashes: Unrecoverable errors, programming bugs 2. Error Categories Recoverable Errors: Network timeouts Missing files Invalid user input API rate limits Unrecoverable Errors: Out of memory Stack overflow Programming bugs (null pointer, etc.) Detailed patterns and worked examples Detailed pattern documentation lives in references/details.md . Read that file when the navigation tier above is insufficient. Best Practices Fail Fast : Validate input early, fail quickly Preserve Context : Include stack traces, metadata, timestamps Meaningful Messages : Explain what happened and how to fix it Log Appropriately : Error = log, expected failure = don't spam logs Handle at Right Level : Catch where you can meaningfully handle Clean Up Resources : Use try-finally, context managers, defer Don't Swallow Errors : Log or re-throw, don't silently ignore Type-Safe Errors : Use typed errors when possible # Good error handling example def process_order ( order_id: str ) -> Order: """Process order with comprehensive error handling.""" try : # Validate input if not order_id: raise ValidationError( "Order ID is required" ) # Fetch order order = db.get_order(order_id) if not order: raise NotFoundError( "Order" , order_id) # Process payment try : payment_result = payment_service.charge(order.total) except PaymentServiceError as e: # Log and wrap external service error logger.error( f"Payment failed for order {order_id} : {e} " ) raise ExternalServiceError( f"Payment processing failed" , service= "payment_service" , details={ "order_id" : order_id, "amount" : order.total} ) from e # Update order order.status = "completed" order.payment_id = payment_result. id db.save(order) return order except ApplicationError: # Re-raise known application errors raise except Exception as e: # Log unexpected errors logger.exception( f"Unexpected error processing order {order_id} " ) raise ApplicationError( "Order processing failed" , code= "INTERNAL_ERROR" ) from e Common Pitfalls Catching Too Broadly : except Exception hides bugs Empty Catch Blocks : Silently swallowing errors Logging and Re-throwing : Creates duplicate log entries Not Cleaning Up : Forgetting to close files, connections Poor Error Messages : "Error occurred" is not helpful Returning Error Codes : Use exceptions or Result types Ignoring Async Errors : Unhandled promise rejections
Agent 识别该技能的关键词,点击任意一个即可复制。

该技能未提供触发词。

下载的 .skill 包内含以下字段。
字段 说明
format格式标识(skill/v1)
skill_id技能唯一 ID
name技能名称
version版本号
description技能描述
category所属分类(数组)
trigger_words触发词列表
tags标签列表
source来源标识
source_url来源链接(本页地址)
exported_at导出时间(每次下载生成)
system_prompt系统提示词正文
model_config模型参数:provider / model / temperature / max_tokens / top_p
examples示例
install_guide各平台导入说明(Coze / Dify / Claude / 自定义框架)
同一份技能可按不同平台格式导出。
.skill 标准格式,含 system_prompt 与 model_config,导入任意 Agent 框架即可使用 下载
.skillpro 增强格式,额外含脚本 / 工具 / 依赖 / 钩子占位 下载
.json 纯 JSON 导出,只含 system_prompt 与模型参数 下载
Coze 带 frontmatter 的 Markdown,Coze 平台导入用 下载
Dify Dify DSL,创建应用后直接导入 下载

每日精选 Skill 推荐,免费送到你邮箱

输入邮箱,每天接收一个精选 AI Agent 技能推荐。完全免费,持续更新。

验证码 --

提交后我们会发送一封确认邮件,点击邮件里的链接才会开始收信。

完全免费,取消任意时间。我们不会发送垃圾邮件。