mirror of
https://github.com/s-frick/effigenix.git
synced 2026-03-28 13:49:36 +01:00
docs: and skills
This commit is contained in:
parent
e4f0665086
commit
ccd4ee534a
25 changed files with 10412 additions and 0 deletions
47
bin/.claude/skills/ddd-model/rules/error-handling.md
Normal file
47
bin/.claude/skills/ddd-model/rules/error-handling.md
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
# Error Handling in DDD
|
||||
|
||||
This document defines error handling principles that apply across all layers and languages.
|
||||
|
||||
## Core Principles
|
||||
|
||||
1. **No Silent Failures** - All errors must be explicitly handled or propagated
|
||||
2. **Layer-Specific Errors** - Each layer defines its own error types
|
||||
3. **Error Transformation** - Errors are transformed at layer boundaries
|
||||
4. **Proper Logging** - Original errors logged before transformation
|
||||
5. **Result Types Over Exceptions** - Prefer Result types (where supported) over exceptions
|
||||
|
||||
## Language-Specific Implementation
|
||||
|
||||
- **Java**: See [languages/java/error-handling.md](../languages/java/error-handling.md)
|
||||
- **Go**: Use error returns and custom error types
|
||||
|
||||
## Error Hierarchy
|
||||
|
||||
```
|
||||
Domain Errors (business rule violations)
|
||||
↓ transformed at boundary
|
||||
Application Errors (use case failures)
|
||||
↓ transformed at boundary
|
||||
Infrastructure Errors (technical failures)
|
||||
```
|
||||
|
||||
## Logging Strategy
|
||||
|
||||
- **ERROR**: Infrastructure failures (database down, network error)
|
||||
- **WARN**: Business rule violations (insufficient funds, invalid state)
|
||||
- **INFO**: Normal operations (order placed, account created)
|
||||
- **DEBUG**: Detailed flow information
|
||||
- **TRACE**: Original errors when transforming between layers
|
||||
|
||||
## Exception Boundary
|
||||
|
||||
**Infrastructure Layer** is the exception boundary:
|
||||
- Infrastructure catches external exceptions (SQL, HTTP, etc.)
|
||||
- Transforms to domain error types
|
||||
- Logs original exception at ERROR level
|
||||
- Returns domain error type
|
||||
|
||||
**Domain and Application** layers:
|
||||
- Never throw exceptions (use Result types or errors)
|
||||
- Only work with domain/application error types
|
||||
- No try/catch blocks needed
|
||||
Loading…
Add table
Add a link
Reference in a new issue