refactor: move fallback error templates to shared directory with improved naming

Reorganize error template structure to consolidate shared templates in a dedicated location.

Changes:
- Move templates/fallback/* to templates/shared/ with -fallback suffix
  - 404.html → 404-fallback.html
  - 500.html → 500-fallback.html
  - generic.html → generic-fallback.html
- Update error_renderer.py to use new template paths
  - Modified template selection logic in _find_template()
  - Updated documentation strings to reflect new paths
- Update error rendering documentation
  - HTML_ERROR_RENDERING_FLOW_DIAGRAM.md: Updated diagrams and examples
  - ERROR_RENDERING_DEVELOPER_DOCUMENTATION.md: Updated file structure and paths

Benefits:
- Clearer organization with all shared templates in shared/ directory
- Consistent naming convention (-fallback suffix) indicates purpose
- Aligns with existing cdn-fallback.html in same directory

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-25 21:06:16 +01:00
parent 5fd68ce6bd
commit 1f2ccb4668
6 changed files with 24 additions and 23 deletions

View File

@@ -85,7 +85,7 @@ app/templates/
├── admin/errors/ # Admin error pages (Phase 1 - COMPLETE)
├── vendor/errors/ # Vendor error pages (Phase 2 - PENDING)
├── shop/errors/ # Shop error pages (Phase 3 - PENDING)
└── fallback/ # Generic fallback pages (COMPLETE)
└── shared/ # Shared fallback error pages (COMPLETE)
```
---
@@ -153,8 +153,8 @@ ErrorPageRenderer.render_error_page(
1. `{context}/errors/{status_code}.html` (e.g., `admin/errors/404.html`)
2. `{context}/errors/generic.html` (e.g., `admin/errors/generic.html`)
3. `fallback/{status_code}.html` (e.g., `fallback/404.html`)
4. `fallback/generic.html` (absolute fallback)
3. `shared/{status_code}-fallback.html` (e.g., `shared/404-fallback.html`)
4. `shared/generic-fallback.html` (absolute fallback)
**Template Variables Provided:**
@@ -353,10 +353,11 @@ app/templates/
│ └── errors/
│ └── (same structure as admin)
└── fallback/
├── 404.html
├── 500.html
── generic.html
└── shared/
├── 404-fallback.html
├── 500-fallback.html
── generic-fallback.html
└── cdn-fallback.html
```
### Base Template Pattern

View File

@@ -83,8 +83,8 @@
│ Priority: │
│ 1. {context}/errors/{code} │
│ 2. {context}/errors/generic│
│ 3. fallback/{code}.html
│ 4. fallback/generic.html
│ 3. shared/{code}-fallback
│ 4. shared/generic-fallback
└──────────┬───────────────────┘
┌──────────────┼──────────────┐
@@ -152,8 +152,8 @@ For a 404 error in ADMIN context:
```
1. Check: app/templates/admin/errors/404.html ✓ EXISTS → USE THIS
2. Check: app/templates/admin/errors/generic.html (skipped)
3. Check: app/templates/fallback/404.html (skipped)
4. Check: app/templates/fallback/generic.html (skipped)
3. Check: app/templates/shared/404-fallback.html (skipped)
4. Check: app/templates/shared/generic-fallback.html (skipped)
```
For a 429 error in SHOP context (not created yet):
@@ -161,8 +161,8 @@ For a 429 error in SHOP context (not created yet):
```
1. Check: app/templates/shop/errors/429.html ✗ Missing
2. Check: app/templates/shop/errors/generic.html ✗ Missing
3. Check: app/templates/fallback/429.html ✗ Missing
4. Check: app/templates/fallback/generic.html ✓ EXISTS → USE THIS
3. Check: app/templates/shared/429-fallback.html ✗ Missing
4. Check: app/templates/shared/generic-fallback.html ✓ EXISTS → USE THIS
```
---
@@ -283,8 +283,8 @@ app/
│ ├── shop/
│ │ └── errors/ # TODO: Shop error pages (themed)
│ │
│ └── fallback/
│ └── (minimal pages) # NEW: Unknown context fallback
│ └── shared/
│ └── *-fallback.html # Shared fallback error pages
middleware/
├── vendor_context.py # Vendor detection (existing)