This commit is contained in:
2026-05-05 21:02:12 +03:30
parent 5301071df5
commit 1679825ae2
47 changed files with 1347 additions and 1403 deletions
+6
View File
@@ -6,6 +6,7 @@ from rest_framework.response import Response
from rest_framework.views import APIView
from config.openapi import build_envelope_serializer, build_response
from rag.failure_contract import RAGServiceError
from .serializers import (
SoilAnomalyDetectionRequestSerializer,
@@ -179,6 +180,11 @@ class SoilAnomalyDetectionView(APIView):
{"code": 404, "msg": str(exc), "data": None},
status=status.HTTP_404_NOT_FOUND,
)
except RAGServiceError as exc:
return Response(
{"code": exc.http_status, "msg": exc.contract.message, "data": exc.to_dict()},
status=exc.http_status,
)
except Exception as exc:
return Response(
{"code": 500, "msg": f"خطا در تحلیل ناهنجاری خاک: {exc}", "data": None},