From 53188fcac6a8dc4696265f07a4e9aae0992edc4a Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 19 Sep 2020 20:54:15 +0200 Subject: [PATCH] remove 'return "foo", 400' style error responses (browse/) --- app/browse/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/browse/__init__.py b/app/browse/__init__.py index 929b775..6d2dc29 100644 --- a/app/browse/__init__.py +++ b/app/browse/__init__.py @@ -1,7 +1,7 @@ import requests from flask import Blueprint, render_template, request, flash, g, url_for, redirect from flask_login import current_user -from werkzeug.exceptions import NotFound +from werkzeug.exceptions import BadRequest, NotFound from ..common.common import * from ..common.innertube import * @@ -123,12 +123,12 @@ def playlist(): #TODO: if anything goes wrong, fall back to xmlfeed playlist_id = request.args.get('list') if not playlist_id: - return "bad list id", 400 # todo + raise BadRequest("No playlist ID") page = int(request.args.get('page', 1)) xmlfeed = fetch_xml("playlist_id", playlist_id) if not xmlfeed: - return "not found or something", 404 # XXX + raise NotFound("Unable to fetch playlist") title, author, _, channel_id, _ = parse_xml(xmlfeed) offset = (page-1)*100 # each call returns 100 items -- 2.39.3