← 返回
未分类 中文

Nm Leyline Error Patterns

Standardized error handling patterns with classification, recovery, and logging strategies. error handling, error recovery, graceful degradation, resilience.
提供错误分类、恢复和优雅降级模式
athola athola 来源
未分类 clawhub v1.9.12 3 版本 100000 Key: 无需
★ 0
Stars
📥 452
下载
💾 1
安装
3
版本
#latest

概述

> Night Market Skill — ported from claude-night-market/leyline. For the full experience with agents, hooks, and commands, install the Claude Code plugin.

Table of Contents

Error Patterns

Overview

Standardized error handling patterns for consistent, production-grade behavior across plugins. Provides error classification, recovery strategies, and debugging workflows.

When To Use

  • Building resilient integrations
  • Need consistent error handling
  • Want graceful degradation
  • Debugging production issues

When NOT To Use

  • Project doesn't use the leyline infrastructure patterns
  • Simple scripts without service architecture needs

Error Classification

By Severity

LevelActionExample
------------------------
CriticalHalt, alertAuth failure, service down
ErrorRetry or secondary strategyRate limit, timeout
WarningLog, continuePartial results, deprecation
InfoLog onlyNon-blocking issues

By Recoverability

class ErrorCategory(Enum):
    TRANSIENT = "transient"      # Retry likely to succeed
    PERMANENT = "permanent"       # Retry won't help
    CONFIGURATION = "config"      # User action needed
    RESOURCE = "resource"         # Quota/limit issue

Verification: Run the command with --help flag to verify availability.

Quick Start

Standard Error Handler

from leyline.error_patterns import handle_error, ErrorCategory

try:
    result = service.execute(prompt)
except RateLimitError as e:
    return handle_error(e, ErrorCategory.RESOURCE, {
        "retry_after": e.retry_after,
        "service": "gemini"
    })
except AuthError as e:
    return handle_error(e, ErrorCategory.CONFIGURATION, {
        "action": "Run 'gemini auth login'"
    })

Verification: Run the command with --help flag to verify availability.

Error Result

@dataclass
class ErrorResult:
    category: ErrorCategory
    message: str
    recoverable: bool
    suggested_action: str
    metadata: dict

Verification: Run the command with --help flag to verify availability.

Common Patterns

Authentication Errors (401/403)

  • Verify credentials exist
  • Check token expiration
  • Validate permissions/scopes
  • Suggest re-authentication

Rate Limit Errors (429)

  • Extract retry-after header
  • Log for quota tracking
  • Implement backoff
  • Consider alternative service

Timeout Errors

  • Increase timeout for retries
  • Break into smaller requests
  • Use async patterns
  • Consider different model

Context Too Large (400)

  • Estimate tokens before request
  • Split into multiple requests
  • Reduce input content
  • Use larger context model

Integration Pattern

# In your skill's frontmatter
dependencies: [leyline:error-patterns]

Verification: Run the command with --help flag to verify availability.

Detailed Resources

  • Classification: See modules/classification.md for error taxonomy
  • Recovery: See modules/recovery-strategies.md for handling patterns
  • Agent Damage Control: See modules/agent-damage-control.md for multi-agent error recovery and escalation

Exit Criteria

  • Error classified correctly
  • Appropriate recovery attempted
  • User-actionable message provided
  • Error logged for debugging

版本历史

共 3 个版本

  • v1.9.12 当前
    2026-06-19 19:54 安全 安全
  • v1.0.2
    2026-05-09 16:38 安全 安全
  • v1.0.1
    2026-05-07 08:47 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

business-ops

Nm Attune Project Planning

athola
将规格说明转化为分阶段、依赖排序的实施计划,用于规格完成后、执行前。
★ 0 📥 716
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,584
dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 72 📥 181,685