Skip to content

Commit f44919b

Browse files
fix: handle Channel.DoesNotExist in remove_self viewset
Signed-off-by: ashnaaseth2325-oss <ashnaaseth2325@gmail.com>
1 parent bbeeea9 commit f44919b

File tree

1 file changed

+3
-2
lines changed
  • contentcuration/contentcuration/viewsets

1 file changed

+3
-2
lines changed

contentcuration/contentcuration/viewsets/user.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,9 @@ def remove_self(self, request, pk=None):
333333
if not channel_id:
334334
return HttpResponseBadRequest("Channel ID is required.")
335335

336-
channel = Channel.objects.get(id=channel_id)
337-
if not channel:
336+
try:
337+
channel = Channel.objects.get(id=channel_id)
338+
except Channel.DoesNotExist:
338339
return HttpResponseNotFound("Channel not found {}".format(channel_id))
339340

340341
if request.user != user and not request.user.can_edit(channel_id):

0 commit comments

Comments
 (0)