hellowind777/helloagents · Archived

hello-errors

实现错误处理、try-catch、日志记录、监控、重试逻辑、降级机制,或处理错误响应和异常管理时使用。

First seen Apr 21, 2026

Installation

$ npx skills add hellowind777/helloagents --skill hello-errors

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from hellowind777/helloagents · top by installs.

npx skills add hellowind777/helloagents

Browse all from hellowind777/helloagents

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 702
License LICENSE.md
Default branch main
Open issues 19
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 1,667 B
  • docs SUMMARY.md 155 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 6 installs

SKILL.md

错误处理相关代码必须遵循以下规范。

编码前

先分类可预期错误 vs 不可预期错误,再写代码。

错误分类

  • 可预期错误(验证失败、资源不存在)→ 正常处理,返回友好信息
  • 不可预期错误(系统故障、第三方宕机)→ 记录日志,返回通用错误
  • 不要用 try-catch 包裹所有代码——只捕获你能处理的

结构化错误

  • 统一错误格式:{ code, message, details? }
  • HTTP 状态码准确:4xx 客户端错误,5xx 服务端错误
  • 不暴露内部实现细节(堆栈、SQL、文件路径)给用户
  • 错误码可枚举,便于前端处理

日志规范

  • 结构化日志(JSON),包含 timestamp、level、context
  • 错误日志包含:堆栈、请求 ID、用户上下文
  • 敏感信息脱敏后再记录(密码、token、身份证)
  • 日志级别:error(必须处理)> warn(需关注)> info(正常流程)> debug(调试)

恢复策略

  • 外部调用:超时 + 重试(指数退避,最多 3 次)
  • 关键操作:幂等设计,支持安全重试
  • 优雅降级:部分功能不可用时不影响核心流程
  • 断路器:连续失败超过阈值时快速失败

交付检查

  • 错误响应格式统一
  • 不暴露内部细节给用户
  • 外部调用有超时设置
  • 敏感信息已脱敏
  • 无静默失败:无空 catch 吞错误、无静默降级、无静默回退(见 HelloAGENTS“失败处理”)