Skip to content

Commit

Permalink
gracful recipes api error on wrong format of update_at
Browse files Browse the repository at this point in the history
  • Loading branch information
vabene1111 committed Feb 16, 2021
1 parent 543e52d commit 894d2d2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cookbook/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.contrib import messages
from django.contrib.auth.models import User
from django.core import management
from django.core.exceptions import FieldError
from django.core.exceptions import FieldError, ValidationError
from django.core.files import File
from django.db.models import Q
from django.http import FileResponse, HttpResponse, JsonResponse
Expand Down Expand Up @@ -70,6 +70,8 @@ def get_queryset(self):
queryset = queryset.filter(updated_at__gte=updated_at)
except FieldError:
pass
except ValidationError:
raise APIException(_('Parameter updated_at incorrectly formatted'))

limit = self.request.query_params.get('limit', None)
random = self.request.query_params.get('random', False)
Expand Down

0 comments on commit 894d2d2

Please sign in to comment.