fix: board 404 returns clean page, not 500
- board.py: catch httpx.HTTPStatusError 404 and show 'Projet introuvable' page - all functional tests pass: dashboard (50 unique), board, issues, checklists, notes, CSRF
This commit is contained in:
@@ -95,6 +95,14 @@ async def board(
|
||||
column_map[col].append(issue)
|
||||
|
||||
except Exception as e:
|
||||
from httpx import HTTPStatusError
|
||||
if isinstance(e, HTTPStatusError) and e.response is not None and e.response.status_code == 404:
|
||||
html = '<div style="padding:48px;text-align:center">'
|
||||
html += '<h2 style="color:var(--text-dim)">Projet introuvable</h2>'
|
||||
html += f'<p style="color:var(--text-dim)">{owner}/{repo} n\'existe pas sur Gitea.</p>'
|
||||
html += '<a href="/" class="btn btn-primary" style="margin-top:16px">Retour aux projets</a>'
|
||||
html += '</div>'
|
||||
return HTMLResponse(html, status_code=404)
|
||||
logger.error("Board error: %s", e)
|
||||
return HTMLResponse(f"<p class='error'>Erreur: {e}</p>", status_code=500)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user