fix DoesNotExist exception

This commit is contained in:
Jason Hunter 2021-07-11 20:58:39 -04:00 committed by Blake Blackshear
parent 2fbfbf614b
commit de121008c1

View File

@ -234,9 +234,9 @@ def event_snapshot(id):
def event_clip(id): def event_clip(id):
download = request.args.get("download", type=bool) download = request.args.get("download", type=bool)
try:
event: Event = Event.get(Event.id == id) event: Event = Event.get(Event.id == id)
except DoesNotExist:
if event is None:
return "Event not found.", 404 return "Event not found.", 404
if not event.has_clip: if not event.has_clip:
@ -689,9 +689,9 @@ def vod_hour(year_month, day, hour, camera):
@bp.route("/vod/event/<id>") @bp.route("/vod/event/<id>")
def vod_event(id): def vod_event(id):
try:
event: Event = Event.get(Event.id == id) event: Event = Event.get(Event.id == id)
except DoesNotExist:
if event is None:
return "Event not found.", 404 return "Event not found.", 404
if not event.has_clip: if not event.has_clip: