Skip to content

Commit f439bf3

Browse files
committed
fix: return error when no proof is found in fdc
1 parent 32c6c8b commit f439bf3

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

fdc/views/v1.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,13 @@ def _proof_by_request_round(self, request, *args, **kwargs):
6565
_body.is_valid(raise_exception=True)
6666
body = _body.validated_data
6767

68-
try:
69-
qs = self.get_queryset().filter(
70-
request_hex=un_prefix_0x(body["requestBytes"])
71-
)
72-
if "votingRoundId" in body:
73-
qs = qs.filter(
74-
voting_round_id=body["votingRoundId"],
75-
)
76-
obj = qs.order_by("-voting_round_id").first()
68+
qs = self.get_queryset().filter(request_hex=un_prefix_0x(body["requestBytes"]))
69+
if "votingRoundId" in body:
70+
qs = qs.filter(voting_round_id=body["votingRoundId"])
71+
72+
obj = qs.order_by("-voting_round_id").first()
7773

78-
except AttestationResult.DoesNotExist:
74+
if obj is None:
7975
return response.Response(
8076
data={"error": "attestation request not found"},
8177
status=status.HTTP_400_BAD_REQUEST,

0 commit comments

Comments
 (0)