Error Handling

Standardizes HTTP exception handling and error logging for api.audace backend.

Updated Aug 27, 2026
One-click install
npx skills add https://github.com/lwilly3/api.audace --skill error-handling-lwilly3
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Error Handling
Source: https://github.com/lwilly3/api.audace/tree/main/.github/skills/error-handling
Command: npx skills add https://github.com/lwilly3/api.audace --skill error-handling-lwilly3

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses inconsistencies in error reporting, silent failures, and the exposure of sensitive details like stack traces in API responses, ensuring a more robust and user-friendly error management system.

Core Features & Use Cases

  • Standardized HTTP Exceptions: Ensures all errors are returned with consistent HTTP status codes and user-friendly messages.
  • Systematic Logging: Implements logging for all caught exceptions, providing crucial context for debugging.
  • Custom Exception Hierarchy: Defines a clear structure for application-specific exceptions (e.g., NotFoundException, PermissionDeniedException).
  • Use Case: When a user attempts to access a resource they don't have permission for, the API will consistently return a 403 Forbidden error with a clear message like "Permission denied: cannot delete user" instead of a generic error or a stack trace.

Quick Start

Implement the standard error handling structure by raising HTTPException with appropriate status codes and detailed messages.

Frequently Asked Questions about Error Handling

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

FAQPage Schema
What is the best way to standardize API error responses in FastAPI?

Standardizing API error responses involves enforcing consistent HTTP status codes, user-friendly messages, and systematic logging to prevent silent failures and stack trace exposure. This approach ensures robust exception management by defining a custom hierarchy for application-specific errors.

How do I stop my API from exposing stack traces in error messages?

To stop exposing stack traces, implement standardized error handling that explicitly prohibits sensitive details in API responses. This system enforces returning consistent HTTP exceptions with user-friendly messages while logging the detailed traceability internally for debugging.

How does systematic logging work for caught exceptions in an API?

Systematic logging for caught exceptions works by capturing the error context whenever an exception is raised, providing crucial traceability for debugging. It operates alongside standardized HTTP exceptions to ensure all failures are recorded without exposing stack traces to the user.

When do I need to use custom exceptions like NotFoundException in CRUD operations?

You need custom exceptions like NotFoundException in CRUD operations when you want to enforce consistent error formats for specific application failures. Raising these custom exceptions ensures the API returns appropriate HTTP status codes, such as a 403 Forbidden for permission denied.

Does this error handling approach work for managing permission denied errors?

Yes, this error handling approach works for managing permission denied errors by utilizing a custom exception hierarchy. When a user lacks access, it consistently returns a 403 Forbidden error with a clear message like 'Permission denied: cannot delete user' instead of a generic failure.