fix: improve error handling for avatar uploads
- Change invalid file type error from 400 to 422 for better frontend handling - Add specific error message for 422 responses in frontend - Improve error message clarity - Better error classification and user guidance Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
@@ -87,8 +87,8 @@ async def upload_avatar(
|
||||
if not file.content_type.startswith("image/"):
|
||||
print("Invalid file type")
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail="Only image files are allowed"
|
||||
status_code=status.HTTP_422_UNPROCESSABLE_ENTITY,
|
||||
detail="Only image files are allowed (JPG, PNG, GIF, etc.)"
|
||||
)
|
||||
|
||||
# Validate file size (5MB limit for upload endpoint)
|
||||
|
||||
Reference in New Issue
Block a user