1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-19 04:49:37 +02:00

fix: improve error handling for Immich image fetching and processing

This commit is contained in:
Sean Morley 2025-06-03 18:11:29 -04:00
parent 442a7724a0
commit 50a80a8116

View file

@ -9,8 +9,6 @@ from adventures.serializers import AdventureImageSerializer
from integrations.models import ImmichIntegration
import uuid
import requests
import tempfile
import os
class AdventureImageViewSet(viewsets.ModelViewSet):
serializer_class = AdventureImageSerializer
@ -121,14 +119,14 @@ class AdventureImageViewSet(viewsets.ModelViewSet):
return Response(serializer.data, status=status.HTTP_201_CREATED)
except requests.exceptions.RequestException as e:
except requests.exceptions.RequestException:
return Response({
"error": f"Failed to fetch image from Immich server: {str(e)}",
"error": f"Failed to fetch image from Immich server",
"code": "immich_fetch_failed"
}, status=status.HTTP_502_BAD_GATEWAY)
except Exception as e:
except Exception:
return Response({
"error": f"Unexpected error processing Immich image: {str(e)}",
"error": f"Unexpected error processing Immich image",
"code": "immich_processing_error"
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)