error-handling-patterns

Standardize error handling with custom exceptions, audit logging, and graceful degradation in Python.

32|5|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/akaszubski/autonomous-dev --skill error-handling-patterns-akaszubski
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: error-handling-patterns
Source: https://github.com/akaszubski/autonomous-dev/tree/main/plugins/autonomous-dev/skills/error-handling-patterns
Command: npx skills add https://github.com/akaszubski/autonomous-dev --skill error-handling-patterns-akaszubski

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Standardized approaches to raise, catch, format, and log errors; including audit logging for security.

Core Features & Use Cases

  • Exception hierarchy
  • Formatted error messages
  • Security audit logging
  • Graceful degradation patterns
  • Example error classes and usage

Quick Start

Quick-start: implement error classes in your library and use audit_log_security_event.

Frequently Asked Questions about error-handling-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I standardize error handling across my Python libraries?

Standardize error handling by defining a custom exception hierarchy specific to your domain, then apply consistent patterns for raising, catching, and formatting errors across all libraries. This ensures uniform error reporting and makes debugging predictable.

What's the best way to implement security audit logging for exceptions?

Implement security audit logging by capturing exceptions and validation failures with structured logs that record context, severity, and user actions. Audit logs create an immutable record of security events for compliance and forensic analysis.

How do I design graceful degradation when errors occur?

Design graceful degradation by catching exceptions at service boundaries, logging the failure, and returning safe defaults or degraded functionality instead of crashing. This keeps systems partially operational during failures.

Can I use error handling patterns with autonomous development workflows?

Yes. Error handling patterns apply to autonomous workflows by standardizing how custom exceptions are raised and caught, ensuring consistent error reporting and audit logging across automated processes and generated code.

What should a domain-specific exception hierarchy include?

A domain-specific exception hierarchy should define base exceptions for your domain, then specialized subclasses for distinct error categories—validation errors, permission errors, resource errors. This enables precise error handling and routing.

Why use formatted error messages instead of raw exceptions?

Formatted error messages provide structured context—what failed, why, and how to recover—making errors actionable for developers and auditable for compliance. Raw exceptions often lack context needed for debugging and logging.