sqlx-errors

Community

Map sqlx errors to safe AppError responses.

Authoradelabdelgawad
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Map sqlx::Error variants to typed AppError responses while avoiding leaking raw error strings to API clients.

Core Features & Use Cases

  • Cross-database-safe error classification using DatabaseError trait methods (is_unique_violation, is_foreign_key_violation, is_check_violation).
  • Comprehensive mappings from common sqlx errors (RowNotFound, DatabaseError with unique/foreign key/check violations) to AppError variants.
  • Safe, structured logging of internal errors with a generic client-facing message.

Quick Start

Provide a Fromsqlx::Error implementation for your AppError and use fetch_optional when appropriate to avoid RowNotFound in user-facing lookups.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: sqlx-errors
Download link: https://github.com/adelabdelgawad/rust-fullstack-agents/archive/main.zip#sqlx-errors

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 510,000+ vetted skills library on demand.