UPDATE
This commit is contained in:
@@ -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},
|
||||
|
||||
Reference in New Issue
Block a user