Fix catch ytapi.ChannelNotFound and return json 404.
This commit is contained in:
parent
4af4985ac5
commit
26704c238e
1 changed files with 2 additions and 2 deletions
|
@ -87,8 +87,8 @@ def post_add_channel():
|
||||||
# It seems they have given us a username instead.
|
# It seems they have given us a username instead.
|
||||||
try:
|
try:
|
||||||
channel_id = common.ycdldb.youtube.get_user_id(username=channel_id)
|
channel_id = common.ycdldb.youtube.get_user_id(username=channel_id)
|
||||||
except IndexError:
|
except ycdl.ytapi.ChannelNotFound:
|
||||||
flask.abort(404)
|
return jsonify.make_json_response({}, status=404)
|
||||||
|
|
||||||
channel = common.ycdldb.add_channel(channel_id, get_videos=True)
|
channel = common.ycdldb.add_channel(channel_id, get_videos=True)
|
||||||
return jsonify.make_json_response(ycdl.jsonify.channel(channel))
|
return jsonify.make_json_response(ycdl.jsonify.channel(channel))
|
||||||
|
|
Loading…
Reference in a new issue